import React, {Component, ComponentClass} from 'react';
import Taro from '@tarojs/taro';
import {Image, Input, Navigator, Picker, PickerView, PickerViewColumn, Text, View} from '@tarojs/components'
import {AtIcon, AtImagePicker, AtTabs} from 'taro-ui'
import {h5Wx} from "../../utils/h5.service";
import CheckGrounp from './components/check-gounp/index'
import Check from './components/check/index';
import NewSwitch from './components/switch/index';
import RadioGrounp from './components/radio-gounp/index';
import NewIcon from './components/icon';
import {Address} from '../../utils/server.interface';
import {
  BASE_URL,
  GOODS_COMPILEDATA,
  GOODSCOMPILEDATA,
  GOODSSITELIST,
  GOODSSUPPLIERLIST,
  REGION_ALLREGIONIDNAME,
  SAVE_AND_UPDATE,
  SUPPLIER_EDITDATA,
  SUPPLIER_GOODS_DETAIL,
  SUPPLIER_IDENTITY,
  TARO_ENV,
  UPLODE_FALE,
  SAVE_AND_UPDATE_QIANGGOU,
  SUPPLIER_GOODS_DETAIL_QIANGGOU
} from "../../constants/api";
import {http} from '../../utils/http';
import GzhAuth from "../../components/gzh-auth/gzh-auth";
import {deepClone, vcmonitor} from "../../utils/tools";
import {lxH5Wx} from "../../utils/lx.h5.service";
import './index.scss'

type StateProps = {
  tadpoleSiteName: any
  pcaDatas: any
  areaData: any
  randKeys: any
  rangeKeys: any
  identity: any
  productTypeList: any
  checkData: any
  fileList: any
  fileList1: any
  type: number | string
  current: any
  dayData: any
  hourData: any
  ageData: any
  formData: any
  siteList: any
  goodsSiteList: any
  storeList: any
  takeEffectList: any
  TicketList: any
  data: Address
  rangeKey: any
  rangeTimeData: any
  isShow: any
  refundList: any
  settlementList: any
  addressData: any
  isEdit: boolean
  randKey: any
  areaHide: any
  index: any
  isHotel: boolean
  isMailGoods: boolean
  isFlashSale: boolean
  areaRadioList: any
  usageTimeList: any
  showSite: boolean
  showGoods: boolean
  takeEffectList1: any
  selectData: any
  formTimer: any
  windowList: any
  moneyData: any
  doBusiness: any
  modeList: any
  oldData: any
  pcaData: any
}

class productForm extends Component {
  state: StateProps = {
    tadpoleSiteName: '',
    pcaDatas: [],
    areaData: {},
    randKeys: [0, 0, 0],
    rangeKeys: {},
    identity: '',
    oldData: {},
    pcaData: [],
    cityValue: null,
    modeList: [
      {
        value: 0,
        label: '开启日历票'
      },
      {
        value: 1,
        label: '开启抢购模式'
      }
    ],
    doBusiness: [
      {
        value: 1,
        label: '自营(独家，可分销)'
      },
      {
        value: 2,
        label: '自营(独家，不可分销)'
      },
      {
        value: 3,
        label: '自营(非独家，可分销)'
      },
      {
        value: 4,
        label: '自营(非独家，不可分销)'
      },
      {
        value: 5,
        label: '分销其他平台'
      }
    ],
    moneyData: [
      {
        label: '差额(佣金)',
        value: 0
      },
      {
        label: '全额',
        value: 1
      }
    ],
    windowList: [
      {
        value: 0,
        label: '无'
      },
      {
        value: 1,
        label: '自我游'
      },
      {
        value: 2,
        label: '票付通'
      },
      {
        value: 3,
        label: '有赞'
      },
      {
        value: 5,
        label: '微程之家'
      },
      {
        value: 4,
        label: '其他'
      }
    ],
    isHotel: false,
    isMailGoods: false,
    isFlashSale: false,
    index: 0,
    areaHide: false,
    areaHideTwo: false,
    selectData: {},
    showSite: false,
    showGoods: false,
    addressData: [],
    formTimer: null,  // 保存缓存的计时器
    rangeTimeData: [],
    rangeKey: {},
    isEdit: false,
    data: {
      address: '',
      add: '',
      name: '',
      phone: '',
      addary: [],
      default: false
    },
    productTypeList: [],
    checkData: [
      {
        value: 0,
        label: '只填写一个人'
      },
      {
        value: 2,
        label: '多人'
      }
    ],
    fileList: [],
    fileList1: [],
    type: 1,
    current: 0,
    dayData: [],
    hourData: [],
    ageData: [],
    siteList: [],
    storeList: [],
    goodsSiteList: [],
    areaRadioList: [
      {
        value: 0,
        label: '以下区域均可购买'
      },
      {
        value: 1,
        label: '以下区域均不可购买'
      }
    ],
    takeEffectList: [
      {
        value: 0,
        label: '立即生效'
      },
      {
        value: 1,
        label: '下单后几小时后生效'
      },
      {
        value: 2,
        label: '提前预约'
      },
      {
        value: 3,
        label: '次日生效'
      },
      {
        value: 4,
        label: '其它'
      }
    ],
    takeEffectList1: [
      {
        value: 3,
        label: '提前预约'
      }
    ],
    TicketList: [
      {
        label: '订单二维码',
        value: 1
      },
      {
        label: '短信电子码',
        value: 2
      },
      {
        label: '姓名电话',
        value: 3
      },
      {
        label: '卡密',
        value: 4
      },
      {
        label: '身份证信息',
        value: 5
      },
      {
        label: '名单电话',
        value: 6
      }
    ],
    formData: {
      sale_style: '0',
      companyList: [],
      specification: [
        {
          ticket_money: '0',
          tadpole_use_system: '0',
          title: '单品1',
          booking_day_end: '0',
          valid_type: null,
          booking_time_end: '23:59:59',
          sell_begin: '',
          sell_end: '',
          order_limit_idcard_region: 0,
          calendar: [
            {
              date_choice: [],
            }
          ],
          is_allow_refund: '0',
          is_allow_refund_name: '不可退',
          refund_sign: [],
          use_rule: {},
          custom_item_config: {
            name: true,
            phone: true,
            mark: false,
            idcard: false,
            upload_file: false,
            comments: false,
            address: false,
            face: false
          },
          verification_limit: 0,
          is_custom_item: 0,
          x_day_refund_rule: {
            day: '0'
          },
          order_limit_config: {
            idcard_region: [
              {}
            ],
            age: {
              min: 0,
              max: 0
            },
            account: {
              count: 0,
              day: 0,
              orderCount: 0
            },
            phone: {
              count: 0,
              day: 0,
              orderCount: 0
            },
            idcard: {
              count: 0,
              day: 0,
              orderCount: 0
            },
            order: {
              min: 0,
              max: 0
            }
          },
          companyList: []
        }
      ],
      type: 'move',
    },
    isShow: [
      {
        additionalCosts: false
      }
    ],
    refundList: [
      {
        label: '不可退',
        value: 0
      },
      /*{
        label: '有效期内可退',
        value: 1
      },*/
      {
        label: '游玩（预约）前X天可退',
        value: 2
      },
      {
        label: '随时退',
        value: 3
      }
    ],
    settlementList: [
      {
        label: '核销数',
        value: 0
      },
      {
        label: '售票数',
        value: 1
      },
      {
        label: '不结算',
        value: 4
      },
      /* {
        label: '前置采购-核销数',
        value: 2
      },
      {
        label: '前置采购-售票数',
        value: 3
      },*/
    ],
    randKey: [0, 0, 0],
    usageTimeList: [],
    submiting: false,
    submitType: null
  }

  async UNSAFE_componentWillMount() {
    await vcmonitor(this)
    if (TARO_ENV === 'h5') {
      await h5Wx.getConfig()
    }
  }

  async componentDidShow() {
    const data = await http.carGet(SUPPLIER_IDENTITY, {})
    if (data) {
      this.setState({identity: data.identity})
    }
    const pages = Taro.getCurrentPages();
    const currPage = pages[pages.length - 1];
    let textareaValue;
    let textareaKey;
    if (process.env.TARO_ENV === 'h5') {
      textareaValue = currPage && currPage.state && currPage.state.textareaValue;
      textareaKey = currPage && currPage.state && currPage.state.textareaKey;
    } else {
      textareaValue = currPage && currPage.__data__ && currPage.__data__.textareaValue;
      textareaKey = currPage && currPage.__data__ && currPage.__data__.textareaKey;
    }
    const {formData, current} = this.state;
    if (textareaKey != 'purchase_information' && textareaKey != 'notice') {
      formData[textareaKey] = textareaValue;
    } else {
      formData.specification[current] = formData.specification[current] || {};
      formData.specification[current][textareaKey] = textareaValue;
    }
    this.setState({
      formData
    });
    this.useUsageTimeList();
  }

  useUsageTimeList() {
    const {formData: {sale_style}} = this.state;
    if (sale_style == 1) {
      this.setState({
        usageTimeList: [
          {
            label: '指定天数',
            value: 2
          },
          {
            label: '截至日期',
            value: 5
          },
          {
            label: '指定日期',
            value: 6
          },
          {
            label: '长期有效',
            value: 8
          },
        ]
      });
    } else {
      this.setState({
        usageTimeList: [
          {
            label: '按出行日期指定天数有效',
            value: 1
          },
          {
            label: '按下单日期指定天数有效',
            value: 2
          },
          {
            label: '指定游玩日期当天可用',
            value: 3
          },
          {
            label: '游客下单当天可用',
            value: 4
          },
          {
            label: '截至日期',
            value: 5
          },
          {
            label: '指定时段',
            value: 6
          }
        ]
      });
    }
  }

  jiaoji(a, b) {
    const c = {}
    for (const item in a) {
      if (b[item] !== undefined && b[item] !== null) {
        c[item] = b[item]
      } else {
        c[item] = a[item]
      }
    }
    return c
  }

  async componentDidMount() {
    const rangeTimeData: any = []
    const hours = Array.from(new Array(24).keys(), val => {
      return val < 10 ? '0' + val : val + ''
    })
    const minute = Array.from(new Array(60).keys(), val => {
      return val < 10 ? '0' + val : val + ''
    })
    rangeTimeData.push(hours)
    rangeTimeData.push(minute)
    rangeTimeData.push(minute)
    const query: any = Taro.getCurrentInstance().router.params;
    const {isShow, formData}: any = this.state;
    formData.sale_style = '0';
    const supplierId = query.id;
    const oldData = JSON.stringify(formData);
    if (supplierId) {
      Taro.showLoading({title: '加载中...'});
      const {id, sale_style} = query;
      let {type} = query
      if (type) {
        type = decodeURIComponent(type)
      }
      let api = ''
      let params = {}
      if (type === '限时抢购') {
        api = SUPPLIER_GOODS_DETAIL_QIANGGOU
        params = {
          goodsId: id,
        }
      } else {
        api = SUPPLIER_GOODS_DETAIL
        params = {
          type: 'move',
          goodsId: id,
          tadpole_goods_type: type
        }
      }
      const res = await http.HGet(api, params);
      let specification: any = []
      if (type === '限时抢购') {
        res.data = JSON.parse(res.data)
        specification.push(deepClone(res.data))
        const garbageArr = ['address', 'area_id', 'city_id', 'goods_lightspot', 'img', 'link_phone', 'mealDetails',
          'name', 'site', 'specification', 'status', 'tadpole_goods_index', 'tadpole_goods_type', 'tadpole_site', 'type']
        for (const k in garbageArr) {
          delete specification[0][garbageArr[k]]
        }
      } else {
        res.data.specification = res.data.specification && JSON.parse(res.data.specification) || [];
        specification = res.data.specification;
      }
      if (res.data.tadpole_site && res.data.tadpole_site.indexOf(',') > -1) {
        res.data.site = res.data.tadpole_site.split(',');
      }
      // 获取门店
      this.getStore(res.data.supplier_id);
      for (let i = 0; specification[i]; i++) {
        specification[i].calendar = specification[i].calendar || [{date_choice: []}];
        const item = specification[i].custom_item_config;
        specification[i].companyList = [];
        if (specification[i].order_limit_config) {
          isShow[i] = {
            additionalCosts: false
          };
          if (specification[i].use_rule.effective_end || specification[i].use_rule.effective_begin || specification[i].use_rule.concreteness_cost) {
            // 额外费用
            isShow[i].additionalCosts = true;
          }
        }
        for (let j = 0; item[`field_${j}`]; j++) {
          specification[i].companyList.push(item[`field_${j}`]);
        }
        specification[i].idcard_region = specification[i].idcard_region == null ? [{}] : specification[i].idcard_region;
        if (specification[i]._sell_time_end) {
          const timeEnd = specification[i]._sell_time_end.split(':')
          const hourss = rangeTimeData[0].findIndex(item => item === timeEnd[0])
          const minutes = rangeTimeData[1].findIndex(item => item === timeEnd[1])
          const seconds = rangeTimeData[2].findIndex(item => item === timeEnd[2])
          specification[i].rangeTimeVal = [hourss, minutes, seconds]
        }
        if (specification[i]._sell_time_begin) {
          const timeEnd = specification[i]._sell_time_begin.split(':')
          const hourss = rangeTimeData[0].findIndex(item => item === timeEnd[0])
          const minutes = rangeTimeData[1].findIndex(item => item === timeEnd[1])
          const seconds = rangeTimeData[2].findIndex(item => item === timeEnd[2])
          specification[i].rangeTimeVal1 = [hourss, minutes, seconds]
        }
      }
      res.data.specification = specification;
      if (res.data.supplier_checker_group_id) {
        res.data.supplier_checker_group_id = res.data.supplier_checker_group_id.split(',');
        res.data.supplier_checker_group_id.map((item, index) => {
          if (!item) {
            res.data.supplier_checker_group_id.splice(index, 1)
          }
        })
      }
      if (type !== '限时抢购') {
        res.data.img = res.data.img && res.data.img.length > 0 && JSON.parse(res.data.img) || [];
      }
      const fileList = res.data.img.map(item => ({url: item.url}));
      const fileList1 = JSON.parse(JSON.stringify(fileList));
      const formData = {
        companyList: [],
        specification: [
          {
            title: '单品1',
            booking_day_end: '0',
            booking_time_end: '23:59:59',
            sell_begin: '',
            sell_end: '',
            valid_type: null,
            order_limit_idcard_region: 0,
            ticket_money: '0',
            tadpole_use_system: '0',
            calendar: [
              {
                date_choice: [],
              }
            ],
            is_allow_refund: '0',
            is_allow_refund_name: '不可退',
            refund_sign: [],
            use_rule: {},
            custom_item_config: {
              name: true,
              phone: true,
              mark: false,
              idcard: false,
              upload_file: false,
              comments: false,
              address: false,
              face: false
            },
            verification_limit: 0,
            is_custom_item: 0,
            x_day_refund_rule: {
              day: '0'
            },
            order_limit_config: {
              idcard_region: [
                {}
              ],
              age: {
                min: 0,
                max: 0
              },
              account: {
                count: 0,
                day: 0,
                orderCount: 0
              },
              phone: {
                count: 0,
                day: 0,
                orderCount: 0
              },
              idcard: {
                count: 0,
                day: 0,
                orderCount: 0
              },
              order: {
                min: 0,
                max: 0
              }
            },
            companyList: []
          }
        ],
        type: 'move',
        refund_sign: [],
        sale_style,
        ...res.data
      }
      const isHotel = formData.tadpole_goods_type === '酒店民宿';
      const isMailGoods = formData.tadpole_goods_type === '邮寄商品';
      const isFlashSale = formData.tadpole_goods_type === '限时抢购';
      // oldData = JSON.stringify(formData);
      this.setState({
        type: 1,
        isShow,
        formData,
        fileList,
        fileList1,
        isEdit: true,
        isHotel,
        isMailGoods,
        isFlashSale
      }, () => this.useUsageTimeList());
      Taro.hideLoading();
    }
    const data = await http.carGet(REGION_ALLREGIONIDNAME)
    this.setState({addressData: data, rangeTimeData}, async () => {
      this.handleCityData([0, 0, 0]);
      this.handleCityDatas([0, 0, 0]);
    })
    const dayData = this.getArr(90);
    const hourData = this.getArr(23);
    const ageData = this.getArr(100);
    // 品牌星级
    let selectData = await http.HGet(SUPPLIER_EDITDATA, {});
    selectData = selectData.data;
    // 商家类型
    const goodsCompiliData = await http.HGet(GOODSCOMPILEDATA, {});
    const productTypeList: any = [];
    for (let i = 0; goodsCompiliData.data[i]; i++) {
      productTypeList.push({
        label: goodsCompiliData.data[i].name,
        value: goodsCompiliData.data[i].name,
        type: goodsCompiliData.data[i].type
      });
    }
    productTypeList.push({
      label: '限时抢购',
      value: '限时抢购',
      type: 1
    })
    // 所属站点
    const siteApi = await http.HGet(GOODSSITELIST, {
      type: 'move'
    });
    const siteList = siteApi.data.map(item => {
      return {
        label: item.name,
        value: item.id
      }
    });
    this.getSite();
    let formTimer: any = null;
    let upData = JSON.stringify(formData);
    if (!supplierId) {
      // 缓存当前填的数据
      let data = Taro.getStorageSync('productFormData');
      const type = Taro.getStorageSync('productFormType');
      const isShow = Taro.getStorageSync('productFormIsShow');
      if (data) {
        Taro.showModal({
          title: '提示',
          cancelText: '取消',
          confirmText: '确认',
          content: '发现一个未保存的草稿 是否恢复草稿?',
          showCancel: true,
          success: (res) => {
            if (res.confirm) {
              upData = data;
              data = JSON.parse(data);
              if (data.supplier_id) {
                this.getStore(data.supplier_id);
              }
              if (isShow) {
                this.setState({isShow})
              }
              if (productTypeList && productTypeList.length > 0 && data.tadpole_goods_type === '酒店民宿') {
                this.setState({isHotel: true}, () => this.useUsageTimeList());
              }
              // 20220902: 根据草稿中的产品类型设置是否是单品
              const isFlashSale = data.tadpole_goods_type === "限时抢购"
              this.setState({formData: data, type, isFlashSale});
            }
            Taro.removeStorageSync('productFormData');
            Taro.removeStorageSync('productFormType');
            Taro.removeStorageSync('productFormIsShow');
          }
        });
      }
      formTimer = setInterval(() => {
        const formData = this.state.formData;
        if (oldData != JSON.stringify(formData) && upData != JSON.stringify(formData)) {
          // 初始化数据被改写并且 在上次缓存后数据被改动 缓存
          Taro.setStorageSync('productFormData', JSON.stringify(formData));
          Taro.setStorageSync('productFormType', this.state.type);
          Taro.setStorageSync('productFormIsShow', this.state.isShow);
          upData = JSON.stringify(formData);
        }
      }, 500);
    }
    this.setState({
      dayData,
      hourData,
      ageData,
      productTypeList,
      siteList,
      addressData: data,
      selectData,
      formTimer
    });
  }

  // 根据站点获取门店
  getSite(sid = 832) {
    http.HGet(GOODSSUPPLIERLIST, {
      type: 'move',
      sid
    }).then(res => {
      const goodsSiteList = res.data.map(item => {
        return {
          value: item.id,
          label: item.company
        }
      })
      this.setState({
        goodsSiteList
      });
    });
  }

  // 生成指定数值数组
  getArr(val) {
    const arr: any = [];
    for (let i = 1; i <= val; i++) {
      arr.push(i);
    }
    return arr;
  }

  // 上传文件的回调
  onFileChange(fileList?, o?, index?) {
    if (!index && index != 0) {
      this.uploadFile(fileList);
    } else {
      this.setState({
        fileList1: fileList
      })
    }
    if (fileList) {
      this.setState({
        fileList
      });
    }
  }

  // 更改current
  handleTabClick(value) {
    this.setState({
      current: value
    })
  }

  // 添加formData的子类
  addCompanyList() {
    const {formData, current} = this.state;
    formData.specification[current].companyList.push({
      value: false,
      k: '',
      key: null
    });
    this.setState({
      formData
    });
  }

  setFormData(formData) {
    this.setState({
      formData
    });
  }

  // 删除formData的子类
  delCompanyList(index) {
    const {formData, current} = this.state;
    formData.specification[current].companyList.splice(index, 1);
    this.setFormData(formData);
  }

  // 添加tab
  addTab() {
    const {formData, isShow} = this.state;
    if (formData.specification.length >= 12) {
      Taro.showToast({title: '已达到单品上限'});
      return;
    }
    isShow.push({
      additionalCosts: false
    });
    formData.specification.push({
      companyList: [],
      title: `单品${formData.specification.length + 1}`,
      order_limit_idcard_region: 0,
      calendar: [
        {
          date_choice: []
        }
      ],
      is_allow_refund: '0',
      is_allow_refund_name: '不可退',
      refund_sign: [],
      tadpole_use_system: '0',
      booking_day_end: '0',
      ticket_money: '0',
      booking_time_end: '23:59:59',
      use_rule: {},
      custom_item_config: {
        name: true,
        phone: true,
        valid_type: null,
        mark: false,
        idcard: false,
        upload_file: false,
        comments: false,
        address: false,
        face: false
      },
      verification_limit: 0,
      is_custom_item: 0,
      x_day_refund_rule: {
        day: '0'
      },
      order_limit_config: {
        idcard_region: [
          {}
        ],
        age: {
          min: 0,
          max: 0
        },
        account: {
          count: 0,
          day: 0,
          orderCount: 0
        },
        phone: {
          count: 0,
          day: 0,
          orderCount: 0
        },
        idcard: {
          count: 0,
          day: 0,
          orderCount: 0
        },
        order: {
          min: 0,
          max: 0
        }
      },
    });
    this.setFormData(formData);
    this.setState({
      isShow,
      current: formData.specification.length - 1
    });
  }

  // 删除当前选中tab
  delTab() {
    const {formData, current, isShow} = this.state;
    formData.specification.splice(current, 1);
    isShow.splice(current, 1);
    this.setState({
      current: current - 1,
      isShow
    });
    formData.specification = formData.specification.map((item, index) => {
      return {
        ...item,
        title: `单品${(parseInt(index) + 1)}`
      }
    });
    this.setFormData(formData);
  }

  // 获取模式名称
  getSaleStyle(index) {
    const {modeList} = this.state;
    return modeList[index] || {};
  }

  // 模式选择
  onSaleStyleChange({detail: {value}}) {
    const {formData, current} = this.state;
    formData.sale_style = value;
    formData.specification[current].valid_type_index = null;
    formData.specification[current].valid_type = null;
    formData.specification[current].valid_type_name = null;
    this.setState({
      formData
    });
    // 重置生效时间
    this.useUsageTimeList();
  }

  // 产品类型选择
  onProductTypeChange({detail: {value}}) {
    let {formData, isEdit, refundList, checkData} = this.state;
    // 清空所有单品
    formData.specification = [
      {
        companyList: [],
        title: `单品1`,
        ticket_money: '0',
        tadpole_use_system: '0',
        order_limit_idcard_region: 0,
        calendar: [
          {
            date_choice: []
          }
        ],
        is_allow_refund: '0',
        is_allow_refund_name: '不可退',
        refund_sign: [],
        booking_day_end: '0',
        booking_time_end: '23:59:59',
        use_rule: {},
        valid_type: null,
        custom_item_config: {
          name: true,
          phone: true,
          mark: false,
          idcard: false,
          upload_file: false,
          comments: false,
          address: false,
          face: false
        },
        verification_limit: 0,
        is_custom_item: 0,
        x_day_refund_rule: {
          day: '0'
        },
        order_limit_config: {
          idcard_region: [
            {}
          ],
          age: {
            min: 0,
            max: 0
          },
          account: {
            count: 0,
            day: 0,
            orderCount: 0
          },
          phone: {
            count: 0,
            day: 0,
            orderCount: 0
          },
          idcard: {
            count: 0,
            day: 0,
            orderCount: 0
          },
          order: {
            min: 0,
            max: 0
          }
        },
        mealDetails: null
      }
    ]
    let isHotel: any = null;
    let isMailGoods: any = null; // 是否是邮寄商品
    let isFlashSale: any = null; // 是否是限时商品
    formData.tadpole_goods_type = this.state.productTypeList[value].label;
    formData.tadpole_goods_index = value;
    isHotel = this.state.productTypeList[value].label === '酒店民宿';
    isMailGoods = this.state.productTypeList[value].label === '邮寄商品';
    isFlashSale = this.state.productTypeList[value].label === '限时抢购';
    if (isFlashSale) {
      formData.sale_style = 1
    }
    if (isMailGoods) {
      refundList = [
        {
          label: '不可退',
          value: 0
        },
        {
          label: '随时退',
          value: 3
        }
      ]
      checkData = [
        {
          value: 0,
          label: '只填写一个人'
        }
      ]
    } else {
      refundList = [
        {
          label: '不可退',
          value: 0
        },
        /*{
          label: '有效期内可退',
          value: 1
        },*/
        {
          label: '游玩（预约）前X天可退',
          value: 2
        },
        {
          label: '随时退',
          value: 3
        }
      ]
      checkData = [
        {
          value: 0,
          label: '只填写一个人'
        },
        {
          value: 2,
          label: '多人'
        }
      ]
    }
    this.setState({
      formData,
      isHotel,
      isMailGoods,
      refundList,
      checkData,
      isFlashSale,
      current: 0
    }, () => this.useUsageTimeList());
  }

  // 更改use_rule child
  useRuleChange(key, value) {
    const {formData, current} = this.state;
    formData.specification[current].use_rule = formData.specification[current].use_rule || {};
    formData.specification[current].use_rule[key] = value;
    this.setState({
      formData
    });
  }

  // 邮寄设置
  isPostChange(key, value) {
    const {formData, current} = this.state;
    formData.specification[current][key] = value
    this.setState({
      formData
    });
  }

  // 更改x_day_refund_rule的child
  useXDayRefundRule(key, value) {
    const {formData, current} = this.state;
    formData.specification[current].x_day_refund_rule = formData.specification[current].x_day_refund_rule || {};
    formData.specification[current].x_day_refund_rule[key] = value;
    if (key == "time") {
      formData.specification[current].x_day_refund_rule[key] = value + ":00";
    }
    this.setState({
      formData
    });
  }

  // 更改order_limit_config的child
  useOrderLimitChange(key, ckey, value) {
    const {formData, current} = this.state;
    formData.specification[current].order_limit_config = formData.specification[current].order_limit_config || {};
    formData.specification[current].order_limit_config[key] = formData.specification[current].order_limit_config[key] || {};
    formData.specification[current].order_limit_config[key][ckey] = value;
    this.setState({
      formData
    });
  }

  changeUseRuleStart(date) {
    this.setSpecification('effective_begin', date);
  }

  changeUseRuleEnd(date) {
    this.setSpecification('effective_end', date);
  }

  // 选择时间
  dateChange(o: any) {
    const {isCheck, value, cindex} = o;
    const {formData, current} = this.state;
    if (value == 'all') {
      if (isCheck == true) {
        formData.specification[current].calendar[cindex] = formData.specification[current].calendar[cindex] || {date_choice: []};
        formData.specification[current].calendar[cindex].date_choice = [1, 2, 3, 4, 5, 6, 7];
      } else {
        formData.specification[current].calendar[cindex] = formData.specification[current].calendar[cindex] || {date_choice: []}
        formData.specification[current].calendar[cindex].date_choice = [];
      }
    } else {
      if (isCheck == true) {
        formData.specification[current].calendar[cindex] = formData.specification[current].calendar[cindex] || {date_choice: []}
        formData.specification[current].calendar[cindex].date_choice.push(parseInt(value));
      } else {
        formData.specification[current].calendar[cindex] = formData.specification[current].calendar[cindex] || {date_choice: []}
        const i = formData.specification[current].calendar[cindex].date_choice.indexOf(parseInt(value));
        formData.specification[current].calendar[cindex].date_choice.splice(i, 1);
      }
    }
    this.setFormData(formData);
  }

  // 选择退款标签
  refundSignChange(o: any) {
    const {isCheck, value, cindex} = o;
    const {formData, current} = this.state;
    if (value == 'all') {
      if (isCheck == true) {
        formData.specification[current].refund_sign = formData.specification[current].refund_sign || [];
        formData.specification[current].refund_sign = [0, 1, 2];
      } else {
        formData.specification[current].refund_sign = formData.specification[current].refund_sign || [];
        formData.specification[current].refund_sign = [];
      }
    } else {
      if (isCheck == true) {
        formData.specification[current].refund_sign = formData.specification[current].refund_sign || [];
        formData.specification[current].refund_sign.push(parseInt(value));
      } else {
        formData.specification[current].refund_sign = formData.specification[current].refund_sign || [];
        const i = formData.specification[current].refund_sign.indexOf(parseInt(value));
        formData.specification[current].refund_sign.splice(i, 1);
      }
    }
    this.setFormData(formData);
  }

  // 添加日历价格
  addCalendar(index) {
    const {formData} = this.state;
    const {specification} = formData;
    specification[index].calendar.push({
      date_choice: []
    });
    formData.specification = specification;
    this.setFormData(formData);
  }

  // 删除日历价格
  delCalendar(index) {
    const {formData} = this.state;
    const {specification} = formData;
    specification[index].calendar.splice(index, 1);
    formData.specification = specification;
    this.setFormData(formData);
  }

  // 更改specification
  setSpecification(key: any, value: any) {
    const {formData, current, settlementList} = this.state;
    const {specification} = formData;
    specification[current] = specification[current] || {};
    specification[current][key] = value;
    if (key == "tadpole_use_system") {
      const q = this.getWindow(value);
      specification[current].tadpole_use_system_index = value;
      specification[current].tadpole_use_system = q.value;
      specification[current].tadpole_use_system_name = q.label;
    }
    if (key == "tadpole_open_type") {
      const q = this.getDoBusiness(value);
      specification[current].tadpole_open_type_index = value;
      specification[current].tadpole_open_type = q.value;
      specification[current].tadpole_open_type_name = q.label;
    }
    if (key == "reserve_date_style") {
      // 购买设置 获取name
      specification[current].reserve_date_style_name = this.getReserveDate(value);
    }
    if (key == "valid_type") {
      // 可用日期 获取nameg
      const q = this.getValidType(value);
      specification[current].valid_type_index = value;
      specification[current].valid_type = q.value;
      specification[current].valid_type_name = q.label;
    }
    if (key == "is_allow_refund") {
      // 退票规则 获取name
      specification[current][key] = this.state.refundList[value].value
      specification[current].is_allow_refund_name = this.getAllowRefund(value);
    }
    if (key == 'booking_time_end') {
      specification[current][key] = value + ':00';
    }
    if (key == 'settlement_way') {
      specification[current][key] = settlementList[value].value
    }
    formData.specification = specification;
    this.setState({
      formData
    });
  }

  // 获取门店
  getStore(supplier_id) {
    http.HGet(GOODS_COMPILEDATA, {
      supplier_id
    }).then(res => {
      const storeList = res.data.map(item => {
        return {
          value: item.id,
          label: item.name,
          phone: item.phone,
          address: item.address
        }
      });
      this.setState({
        storeList
      });
    });
  }

  // 浅拷贝
  copy(data) {
    return data.map(item => item);
  }

  // 处理部分参数
  dealSomeParams(params) {
    const query: any = Taro.getCurrentInstance().router.params;
    const site_list = query.site_list;
    const operate = query.operate;
    // 是否复制
    if (operate && operate === "copy") {
      // 复制: 作为新增
      if (params.goods_id) delete params.goods_id;
      /**
       * 是否有默认站点
       *
       * 限时抢购 不需要处理. 因为限时抢购(SUPPLIER_GOODS_DETAIL_QIANGGOU)回显的数据不包含默认站点
       **/
      if (!!site_list) {
        const site_list_arr = site_list.split(",");
        const new_site_list = [];

        for (let i = 0, len = params.site.length; i < len; i++) {
          const theSite = params.site[i];
          let flag = false; // 是否包含默认站点

          for (let j = 0, len2 = site_list_arr.length; j < len2; j++) {
            if (site_list_arr[j] == theSite) {
              flag = true;
              break;
            }
          }
          if (!flag && !!theSite) new_site_list.push(theSite); // 不包含 && 当前站点有效
        }

        params.site = new_site_list;
        params.tadpole_site = params.site.join(",");
        params.tadpole_site = params.tadpole_site.lastIndexOf(",") < 0 ? params.tadpole_site + "," : params.tadpole_site;
      }
    }
    return params;
  }

  // type0 保存  1保存并提交
  async save(type = 0) {
    if (this.state.submiting) return;
    const {formData, current, fileList1, refundList, isShow, isHotel, isFlashSale} = this.state;
    const newFormData = deepClone(formData)
    for (let i = 0; i < newFormData.specification.length; i++) {
      if (typeof newFormData.specification[i].settlement_way == "undefined") {
        return Taro.showToast({title: `请选择, 单品${i + 1}的结算方式`, icon: 'none'});
      }
    }
    const flag = newFormData.specification.every(item => typeof item.settlement_way !== "undefined")
    if (!flag) {
      return Taro.showToast({title: '请选择结算方式', icon: 'none'});
    }
    if (!formData.goods_lightspot) {
      Taro.showToast({title: '请填写必要信息', icon: 'none'});
      return
    }
    await this.setState({submiting: true, submitType: type});
    Taro.showLoading({title: '加载中...'});
    newFormData.site = new Set(newFormData.site);
    newFormData.site = [...newFormData.site];
    const site: any = newFormData.site && newFormData.site.length > 0 && this.copy(newFormData.site).join() || '';
    const supplier_checker_group_id: any = newFormData.supplier_checker_group_id && newFormData.supplier_checker_group_id.length > 0 && this.copy(newFormData.supplier_checker_group_id).join();
    const specification = newFormData.specification.map((item, index) => {
      if (item._sell_time_begin && item._sell_time_begin.length === 5) { // 00:00
        item._sell_time_begin += ':00'
      }
      if (item._sell_time_end && item._sell_time_end.length === 5) { // 00:00
        item._sell_time_end += ':00'
      }
      const {use_rule} = item;
      const {additionalCosts} = isShow[index];
      // 规则限制 0 以下单日期限制 1 以出行日期限制
      item.order_limit_config.type = 0;
      item.order_limit = item.order_limit == true ? 1 : 0;
      if (additionalCosts == false) {
        // 额外费用
        item.use_rule.concreteness_cost = '';
      }
      if (use_rule.is_child == false) {
        // 儿童
        item.use_rule.child_stature = null;
        item.use_rule.child_age = null;
      }
      // 单品价格 如果不传需要给后端发送0.00
      if (!item.price || item.price.trim() == '') {
        item.price = '0.00';
      } else {
        item.price = parseFloat(item.price).toFixed(2);
      }
      if (!item.seller_price || item.seller_price.trim() == '') {
        item.seller_price = '0.00';
      } else {
        item.seller_price = parseFloat(item.seller_price).toFixed(2);
      }
      if (!item.supplier_price || item.supplier_price.trim() == '') {
        item.supplier_price = '0.00';
      } else {
        item.supplier_price = parseFloat(item.supplier_price).toFixed(2);
      }
      // 日历价格 如果不传需要给后端发送0.00
      for (let i = 0; item.calendar[i]; i++) {
        if (!item.calendar[i].price || item.calendar[i].price.trim() == '') {
          item.calendar[i].price = '0.00';
        } else {
          item.calendar[i].price = parseFloat(item.calendar[i].price).toFixed(2);
        }
        if (!item.calendar[i].seller_price || item.calendar[i].seller_price.trim() == '') {
          item.calendar[i].seller_price = '0.00';
        } else {
          item.calendar[i].seller_price = parseFloat(item.calendar[i].seller_price).toFixed(2);
        }
        if (!item.calendar[i].supplier_price || item.calendar[i].supplier_price.trim() == '') {
          item.calendar[i].supplier_price = '0.00';
        } else {
          item.calendar[i].supplier_price = parseFloat(item.calendar[i].supplier_price).toFixed(2);
        }
      }
      const {
        effective_begin,
        effective_end,
        is_child,
        is_appointment,
        is_holidays,
        is_collage,
        is_allow_refund
      } = use_rule;
      // 组织companList的数据
      for (let i = 0; item.companyList[i]; i++) {
        newFormData.specification[index].custom_item_config[`field_${i}`] = item.companyList[i];
      }
      if (isHotel) {
        // 是酒店
        if (item.reserve_date_style === 0 || item.reserve_date_style === '0') {
          item.reserve_date_style = 2;
        }
      }
      if (newFormData.sale_style == 1) {
        item.calendar = null;
      }
      return {
        ...item,
        reserve_date_style: item.reserve_date_style,
        refund_sign: item.refund_sign && item.refund_sign.length > 0 && Array.isArray(item.refund_sign) ? item.refund_sign.join(",") : "",
        supplier_checker_group_id,
        use_rule: {
          ...use_rule,
          effective_begin: effective_begin != '' && effective_begin != undefined && effective_begin + ':00' || '',
          effective_end: effective_end != '' && effective_end != undefined && effective_end + ':00' || '',
          is_allow_refund: is_allow_refund && refundList[is_allow_refund].value,
          is_child: is_child == true ? 1 : 0,
          is_appointment: is_appointment == true ? 1 : 0,
          is_holidays: is_holidays == true ? 1 : 0,
          is_collage: is_collage == true ? 1 : 0
        },
        sale_style: newFormData.sale_style,
        supplier_id: newFormData.supplier_id,
        calendar: item.calendar
      }
    });
    const query: any = Taro.getCurrentInstance().router.params;
    const supplierId = query.id;
    const site_list = query.site_list;
    const operate = query.operate;
    const img = fileList1;
    // const img = [{'url': 'https://resource.ivcheng.com/upload/2022/05/07/55d85e07c6a74f838f71f507e6fcc637.png'}];
    delete newFormData._provinceName
    delete newFormData._cityName
    delete newFormData._area
    // delete newFormData.add
    delete newFormData.randKeys
    let params = {}
    const specificationClone = {}
    if (isFlashSale) {
      for (const k in newFormData) {
        specificationClone[k] = newFormData[k]
      }
      delete specificationClone['specification']
      for (const k in specification[0]) {
        specificationClone[k] = specification[0][k]
      }
      specificationClone['companyList'] = newFormData.companyList
      specificationClone['status'] = type
      specificationClone['tadpole_site'] = site || ''
      specificationClone['img'] = img
      specificationClone['add'] = newFormData.add
      specificationClone['tadpoleSiteName'] = newFormData.tadpoleSiteName
      params = {
        goods_id: query.id || '',
        type: 'move',
        status: type,
        // goods_id: ,
        dataStr: JSON.stringify(specificationClone)
      }
      // 是否复制
      if (operate && operate === "copy") {
        // 复制: 作为新增
        if (params.goods_id) delete params.goods_id;
      }
      const res = await http.postCar(SAVE_AND_UPDATE_QIANGGOU, params, {}, {}, 5000);
      if (res) {
        clearInterval(this.state.formTimer);
        setTimeout(() => {
          Taro.hideLoading();
          // 删除储存并清楚计时器
          Taro.removeStorageSync('productFormData');
          Taro.removeStorageSync('productFormType');
          Taro.navigateBack({
            delta: 1
          });
        }, 300);
      }
    } else {
      params = {
        ...newFormData,
        companyList: JSON.stringify(newFormData.companyList),
        specification: JSON.stringify(specification),
        status: type,
        tadpole_site: site || '',
        img: JSON.stringify(img)
      }
      // 处理 复制/默认站点
      params = this.dealSomeParams(params);
      const res = await http.postCar(SAVE_AND_UPDATE, params, {}, {}, 5000);
      if (res) {
        clearInterval(this.state.formTimer);
        setTimeout(() => {
          Taro.hideLoading();
          // 删除储存并清楚计时器
          Taro.removeStorageSync('productFormData');
          Taro.removeStorageSync('productFormType');
          Taro.navigateBack({
            delta: 1
          });
        }, 300);
      }
    }
  }

  getAddressName = (index, value) => {
    // 这里是转化用户选择的地址数据
    const {current, formData, addressData} = this.state;
    if (addressData[value[0]]) {
      formData.specification[current].idcard_region[index].province = addressData[value[0]].name; // 省名称
      if (
        addressData[value[0]].areaList &&
        addressData[value[0]].areaList[value[1]]
      ) {
        formData.specification[current].idcard_region[index].city = addressData[value[0]].areaList[value[1]].name;
        if (
          addressData[value[0]].areaList[value[1]].areaList &&
          addressData[value[0]].areaList[value[1]].areaList[value[2]]
        ) {
          formData.specification[current].idcard_region[index].country =
            addressData[value[0]].areaList[value[1]].areaList[
              value[2]
              ].name;
        }
      }
    }
    formData.specification[current].order_limit_config.idcard_region[index].addary = value
    formData.specification[current].idcard_region[index].add =
      formData.specification[current].order_limit_config.idcard_region[index].province + ',' +
      formData.specification[current].order_limit_config.idcard_region[index].city + "," +
      formData.specification[current].order_limit_config.idcard_region[index].country;
    this.setState({
      formData
    });
  };

  // 添加一个区域限制
  addIdcardRegion() {
    const {current, formData} = this.state;
    formData.specification[current].order_limit_config.idcard_region.push({});
    this.setFormData(formData);
  }

  // 删除一个区域限制
  delIdcardRegion(i) {
    const {current, formData} = this.state;
    if (i == 0) {
      formData.specification[current].order_limit_config.idcard_region[0] = {};
    } else {
      formData.specification[current].order_limit_config.idcard_region.splice(i, 1);
    }
    this.setFormData(formData);
  }

  // 获取购买设置
  getReserveDate(i) {
    const {takeEffectList} = this.state;
    return takeEffectList[i] && takeEffectList[i].label;
  }

  // 获取取票方式
  getTicketWay(i) {
    const {TicketList} = this.state;
    return TicketList[i] && TicketList[i].label;
  }

  onColumnChange = e => {
    const {rangeKey} = this.state;
    const changeColumn = e.detail;
    const {column, value} = changeColumn;
    switch (column) { // 根据改变不同的列，来显示不同的数据
      case 0:
        this.handleCityData([value, 0, 0]);
        break;
      case 1:
        this.handleCityData([rangeKey[0], value, 0]);
        break;
      case 2:
        this.handleCityData([rangeKey[0], rangeKey[1], value]);
        break;
    }
  };

  onColumnChanges = e => {
    const {rangeKeys} = this.state;
    const changeColumn = e.detail;
    const {column, value} = changeColumn;
    switch (column) { // 根据改变不同的列，来显示不同的数据
      case 0:
        this.handleCityDatas([value, 0, 0]);
        break;
      case 1:
        this.handleCityDatas([rangeKeys[0], value, 0]);
        break;
      case 2:
        this.handleCityDatas([rangeKeys[0], rangeKeys[1], value]);
        break;
    }
  };

  hide() {
    this.setState({
      areaHide: false
    });
  }

  // 省市区 区域限制
  addChange(indexs) {
    const {formData, current, addressData, randKey, rangeKey, pcaData} = this.state;
    const index = indexs || this.state.index;
    if (process.env.TARO_ENV === 'weapp') {
      const province = randKey[0];
      const city = randKey[1];
      const area = randKey[2];
      formData.specification[current].order_limit_config.idcard_region[index].randKey = randKey;
      formData.specification[current].order_limit_config.idcard_region[index].province = parseInt(addressData[province].id);
      formData.specification[current].order_limit_config.idcard_region[index]._provinceName = addressData[province].name;
      formData.specification[current].order_limit_config.idcard_region[index].city = parseInt(addressData[province].areaList[city].id);
      formData.specification[current].order_limit_config.idcard_region[index]._cityName = addressData[province].areaList[city].name;
      formData.specification[current].order_limit_config.idcard_region[index].area = parseInt(addressData[province].areaList[city].areaList[area].id);
      formData.specification[current].order_limit_config.idcard_region[index]._area = addressData[province].areaList[city].areaList[area].name;
      formData.specification[current].order_limit_config.idcard_region[index].add =
        formData.specification[current].order_limit_config.idcard_region[index]._provinceName + '-' +
        formData.specification[current].order_limit_config.idcard_region[index]._cityName + '-' +
        formData.specification[current].order_limit_config.idcard_region[index]._area;
      this.showArea();
    } else {
      const province = rangeKey[0];
      const city = rangeKey[1];
      const area = rangeKey[2];
      const provinceList = pcaData[0];
      const cityList = pcaData[1];
      const areaList = pcaData[2];
      formData.specification[current].order_limit_config.idcard_region[index].randKey = randKey;
      formData.specification[current].order_limit_config.idcard_region[index].province = parseInt(provinceList[province].id);
      formData.specification[current].order_limit_config.idcard_region[index]._provinceName = provinceList[province].name;
      formData.specification[current].order_limit_config.idcard_region[index].city = parseInt(cityList[city].id);
      formData.specification[current].order_limit_config.idcard_region[index]._cityName = cityList[city].name;
      formData.specification[current].order_limit_config.idcard_region[index].area = parseInt(areaList[area].id);
      formData.specification[current].order_limit_config.idcard_region[index]._area = areaList[area].name;
      formData.specification[current].order_limit_config.idcard_region[index].add =
        formData.specification[current].order_limit_config.idcard_region[index]._provinceName + '-' +
        formData.specification[current].order_limit_config.idcard_region[index]._cityName + '-' +
        formData.specification[current].order_limit_config.idcard_region[index]._area;
    }
    this.setState({formData});
  }

  // 省市区 区域限制
  addChanges() {
    const {formData, addressData, randKeys, rangeKeys, pcaDatas, randKey} = this.state;
    if (process.env.TARO_ENV === 'weapp') {
      const province = randKey[0];
      const city = randKey[1];
      const area = randKey[2];
      formData.randKeys = randKey;
      formData.province_id = parseInt(addressData[province].id);
      formData._provinceName = addressData[province].name;
      formData.city_id = parseInt(addressData[province].areaList[city].id);
      formData._cityName = addressData[province].areaList[city].name;
      formData.area_id = parseInt(addressData[province].areaList[city].areaList[area].id);
      formData._area = addressData[province].areaList[city].areaList[area].name;
      formData.add = formData._provinceName + '-' + formData._cityName + '-' + formData._area;
      this.showAreas(false, randKey);
    } else {
      const province = rangeKeys[0];
      const city = rangeKeys[1];
      const area = rangeKeys[2];
      const provinceList = pcaDatas[0];
      const cityList = pcaDatas[1];
      const areaList = pcaDatas[2];
      formData.randKeys = randKeys;
      formData.province_id = parseInt(provinceList[province].id);
      formData._provinceName = provinceList[province].name;
      formData.city_id = parseInt(cityList[city].id);
      formData._cityName = cityList[city].name;
      formData.area_id = parseInt(areaList[area].id);
      formData._area = areaList[area].name;
      formData.add = formData._provinceName + '-' + formData._cityName + '-' + formData._area;
    }
    this.setState({formData});
  }

  // 修改CustomItemConfig
  setCustomItemConfig(key, value) {
    const {formData, current} = this.state;
    formData.specification[current].custom_item_config = formData.specification[current].custom_item_config || {};
    formData.specification[current].custom_item_config[key] = value;
    this.setState({
      formData
    });
  }

  // 修改companyList
  pushCompanyList(key, value, index) {
    const {formData, current} = this.state;
    formData.specification[current].companyList[index][key] = value;
    this.setFormData(formData);
  }

  // 站点选择
  siteChange(key, e) {
    const {formData, siteList} = this.state;
    formData[key] = e;
    if (key == 'supplier_id') {
      this.getStore(e);
      formData.supplier_checker_group_id = ''
    }
    const arr = []
    if (key !== 'supplier_id') {
      e.map((index, item) => {
        for (let i = 0; i < siteList.length; i++) {
          if (index == siteList[i].value) {
            arr.push(siteList[i].label)
          }
        }
      })
      formData.tadpoleSiteName = arr.join(',')
    }
    this.setFormData(formData);
  }

  storeChange(key, e) {
    const {formData, storeList} = this.state;
    formData[key] = e;
    if (key == 'supplier_checker_group_id') {
      // 选择门店
      for (let i = 0; storeList[i]; i++) {
        if (storeList[i].value == e[0]) {
          formData.link_phone = storeList[i].phone;
          // formData.address = storeList[i].address;
        }
      }
    }
    this.setFormData(formData);
  }

  getSupplierName(id) {
    const goodsSite = this.state.goodsSiteList.filter(item => item.value == id);
    return goodsSite.length > 0 ? goodsSite[0].label : '';
  }

  getCheckerName(id) {
    const store = this.state.storeList.filter(item => item.value == id);
    return store.length > 0 ? store[0].label : '';
  }

  // 封装isShow的子级方法
  setIsShow(key, value) {
    const {isShow, current} = this.state;
    isShow[current][key] = value;
    this.setState({isShow});
  }

  // 邮寄设置开关
  isPostShow(key, value) {
    const {isShow, current, formData} = this.state;
    formData.specification[current][key] = value;
    this.setState({formData});
  }

  // 获取退款
  getAllowRefund(value) {
    return this.state.refundList.length > 0 ? this.state.refundList[value].label : '';
  }

  // 清除退款
  clearAllowRefund(idx) {
    const {formData, current, settlementList} = this.state;
    const {specification} = formData;
    specification[idx] = specification[idx] || {};
    specification[idx].is_allow_refund = "";
    specification[idx].is_allow_refund_name = "";

    formData.specification = specification;
    this.setState({
      formData
    });
  }

  // 获取结构
  getSettlement(value) {
    let val = -1
    if (value === 2) {
      val = 0
    } else if (value === 3) {
      val = 1
    }
    for (let i = 0; i < this.state.settlementList.length; i++) {
      if (this.state.settlementList[i].value == value) {
        val = i
      } else {
      }
    }
    return this.state.settlementList[val] ? this.state.settlementList[val].label : '';
  }

  // 查找可用日期
  getValidType(value) {
    return this.state.usageTimeList[value];
  }

  // 上传文件
  async uploadFile(files) {
    const api = BASE_URL + UPLODE_FALE
    if (TARO_ENV === 'h5') {
      lxH5Wx.chooseImage(async (f, length) => {
        lxH5Wx.uploadFile(f, length, (data) => {
          const {fileList} = this.state;
          fileList.push({
            url: data
          });
          this.setState({
            fileList,
            fileList1: JSON.parse(JSON.stringify(fileList))
          });
        })
      }, 2)
    } else {
      const header = http.getHeader();
      const user = Taro.getStorageSync("user");
      header.token = user.token;
      const file: any = [];
      // 获取新文件
      const newFile: any = [];
      const oldFile: any = [];
      for (let i = 0; files[i]; i++) {
        if (files[i].url.indexOf('//tmp') == -1) {
          oldFile.push(files[i])
        } else {
          newFile.push(files[i])
        }
      }
      let uploadImgCount = 0;
      for (let i = 0; newFile[i]; i++) {
        Taro.showLoading({title: '加载中...'});
        Taro.uploadFile({
          url: api,
          filePath: newFile[i].url,
          name: 'file',
          formData: {
            'imgIndex': i
          },
          header,
          success: (res: any) => {
            uploadImgCount++;
            if (res.statusCode != 200) {
              Taro.showToast({
                title: res.data,
                icon: 'none'
              })
              return
            }
            const data: any = JSON.parse(res.data);
            const imageUrl: string = data.imageUrl;
            file.push({
              url: imageUrl
            });
            if (uploadImgCount == newFile.length) {
              let fileList1 = oldFile;
              fileList1 = fileList1.concat(file);
              this.setState({
                fileList1
              });
            }
            Taro.hideLoading();
          },
          fail: function (res) {
            Taro.hideLoading();
            Taro.showModal({
              title: '错误提示',
              content: '上传图片失败',
              showCancel: false
            })
          }
        });
      }
    }
  }

  // 复制tab
  copyTab() {
    const {current, formData, isShow} = this.state;
    const {specification} = formData;
    if (specification.length >= 12) {
      Taro.showToast({title: '已达到单品上限'});
      return;
    }
    specification.push(JSON.parse(JSON.stringify(specification[current])));
    specification[formData.specification.length - 1].title = `单品${formData.specification.length}`;
    formData.specification = specification;
    isShow[formData.specification.length - 1] = {
      additionalCosts: false
    };
    this.setState({
      formData,
      isShow,
      current: formData.specification.length - 1
    });
  }

  // 日历价格
  setCalendar(key, value, index) {
    const {formData, current} = this.state;
    const {specification} = formData;
    specification[current] = specification[current] || {};
    specification[current].calendar[index][key] = value;
    formData.specification = specification;
    this.setFormData(formData);
  }

  // 滑动
  onSlide({detail: {value}}) {
    this.setState({
      randKey: value
    })
  }

  showArea(isShow = false, index?, randKey?) {
    randKey = randKey || [0, 0, 0];
    this.setState({
      areaHide: isShow,
      index,
      randKey
    });
  }

  showAreas(isShow = false, randKey?) {
    const {formData} = this.state
    formData['randKey'] = randKey || [0, 0, 0]
    this.setState({areaHideTwo: isShow, formData})
  }

  useState(key, value) {
    this.setState({
      [key]: value
    });
  }

  setBrandStart(value: any, key) {
    const {selectData, formData} = this.state;
    formData[key] = selectData[key][value].label_no;
    this.setFormData(formData);
  }

  getBrandStart(value: any, key) {
    const {selectData} = this.state;
    const o = selectData[key].filter(item => item.label_no == value);
    return o && o[0].label_name;
  }

  getWindow(value) {
    const {windowList} = this.state;
    return windowList[value] || {};
  }

  getDoBusiness(value) {
    return this.state.doBusiness[value] || {};
  }

  handleCityDatas = key => {
    const {addressData} = this.state
    // 处理数据。
    const provinceList = []; // 省
    const cityList = []; // 市
    const areaList = []; // 区
    for (let i = 0; i < addressData.length; i++) {
      // 获取省
      const province = addressData[i];
      provinceList.push({name: province.name, id: province.id});
    }
    if (addressData[key[0]].areaList && addressData[key[0]].areaList.length > 0) {
      for (let i = 0; i < addressData[key[0]].areaList.length; i++) {
        // 获取对应省下面的市
        const city = addressData[key[0]].areaList[i];
        cityList.push({name: city.name, id: city.id});
      }
    }
    for (let i = 0; i < addressData[key[0]].areaList[key[1]].areaList.length; i++) {
      // 获取市下面对应区
      const area = addressData[key[0]].areaList[key[1]].areaList[i];
      areaList.push({name: area.name, id: area.id});
    }
    // }
    const newRange = [];
    newRange.push(provinceList);
    newRange.push(cityList);
    newRange.push(areaList);
    this.setState({
      pcaDatas: newRange, /* 省市区所有的数据*/
      rangeKeys: key /* key是多列选择器需要展示的下标，因为是初始化，所以我们传入[0,0,0]*/
    });
  };
  handleCityData = key => {
    const {addressData} = this.state
    // 处理数据。
    const provinceList = []; // 省
    const cityList = []; // 市
    const areaList = []; // 区
    for (let i = 0; i < addressData.length; i++) {
      // 获取省
      const province = addressData[i];
      provinceList.push({
        name: province.name,
        id: province.id
      });
    }
    if (addressData[key[0]].areaList && addressData[key[0]].areaList.length > 0) {
      for (let i = 0; i < addressData[key[0]].areaList.length; i++) {
        // 获取对应省下面的市
        const city = addressData[key[0]].areaList[i];
        cityList.push({
          name: city.name,
          id: city.id
        });
      }
    }
    for (
      let i = 0;
      i < addressData[key[0]].areaList[key[1]].areaList.length;
      i++
    ) {
      // 获取市下面对应区
      const area = addressData[key[0]].areaList[key[1]].areaList[i];
      areaList.push({
        name: area.name,
        id: area.id
      });
    }
    // }
    const newRange = [];
    newRange.push(provinceList);
    newRange.push(cityList);
    newRange.push(areaList);
    this.setState({
      pcaData: newRange, // 省市区所有的数据
      rangeKey: key // key是多列选择器需要展示的下标，因为是初始化，所以我们传入[0,0,0]
    });
  };

  timeChange = (key, val) => {
    const {rangeTimeData, formData, current} = this.state
    const hours = rangeTimeData[0][val[0]]
    const minute = rangeTimeData[1][val[1]]
    const second = rangeTimeData[2][val[2]]
    const {specification} = formData;
    specification[current] = specification[current] || {};
    specification[current][key] = hours + ':' + minute + ':' + second;
    formData.specification = specification;
    this.setState({
      formData
    });
  }

  onChangeTime = e => {
    this.timeChange('_sell_time_end', e.detail.value)
  }

  onChangeTime1 = e => {
    this.timeChange('_sell_time_begin', e.detail.value)
  }

  render() {
    const {
      submiting,
      submitType,
      isFlashSale,
      areaHideTwo,
      pcaDatas,
      identity,
      isHotel,
      isMailGoods,
      cityValue,
      doBusiness,
      modeList,
      moneyData,
      windowList,
      selectData,
      showGoods,
      TicketList,
      showSite,
      usageTimeList,
      areaRadioList,
      areaHide,
      randKey,
      isEdit,
      settlementList,
      refundList,
      isShow,
      data,
      pcaData,
      rangeTimeData,
      current,
      takeEffectList,
      goodsSiteList,
      siteList,
      storeList,
      checkData,
      fileList,
      type,
      dayData,
      hourData,
      formData,
      productTypeList,
      ageData,
      takeEffectList1
    } = this.state;
    const {companyList, specification} = formData;
    const province = randKey[0];
    const city = randKey[1];
    const area = randKey[2];
    return (
      <View className={`product-form ${process.env.TARO_ENV === 'h5' ? 'h5' : ''}`}>
        <GzhAuth />
        <View className='product-form-block m-t-20' style='margin-top: 0;'>
          <View className='product-form-block-item border-bottom'>
            <View className='product-form-block-item-left require'>
              商品名称
            </View>
            <View className='product-form-block-item-right t-a-l'>
              <View className='value'>
                <Input
                  placeholder='请输入商品名称'
                  onInput={({detail: {value}}) => {
                    const {formData} = this.state;
                    formData.name = value;
                    this.setFormData(formData);
                  }}
                  value={formData.name}
                />
              </View>
            </View>
          </View>

          <View className={`product-form-block-item border-bottom ${showSite ? 'o-n' : ''}`}>
            <View className='product-form-block-item-left require'>
              所属站点
            </View>
            <View className='product-form-block-item-right o-n'>
              <CheckGrounp
                onChange={(e) => this.siteChange('site', e)}
                data={siteList}
                value={formData.site}
                disabled={isEdit}
                isAll
              />
              <View
                className='ret-image1'
                onClick={() => this.useState('showSite', !showSite)}
                style={showSite ? 'transform: rotate(-180deg); bottom: 2px;' : ''}
              >
                <AtIcon
                  value='icon icon-a-2tubiaozhizuomoban-01-011'
                  size='14'
                />
              </View>
            </View>
          </View>
          {!isEdit && <Picker
            mode='selector'
            range={productTypeList}
            onChange={this.onProductTypeChange.bind(this)}
            rangeKey='label'
            value={formData.tadpole_goods_index}
          >
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require'>
                产品类型
              </View>
              <View className='product-form-block-item-right t-a-r'>
                {!formData.tadpole_goods_type && <View className='mepty'>
                  未添加
                  <Text className='ret'>{`>`}</Text>
                </View>}
                {formData.tadpole_goods_type && <View className='value c-666'>
                  {formData.tadpole_goods_type}
                </View>}
              </View>
            </View>
          </Picker>}
          {
            isEdit && <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require'>
                产品类型
              </View>
              <View className='product-form-block-item-right t-a-r'>
                <View className='value'>
                  {formData.tadpole_goods_type}
                </View>
              </View>
            </View>
          }
          {/* 20220902: 排除草稿中的"限时抢购" */}
          {!isFlashSale && !isMailGoods && formData.tadpole_goods_type && formData.tadpole_goods_type !== "限时抢购" &&
            <Picker
              mode='selector'
              range={modeList}
              onChange={this.onSaleStyleChange.bind(this)}
              rangeKey='label'
              value={formData.sale_style}
            >
              <View className='product-form-block-item border-bottom'>
                <View className='product-form-block-item-left require'>
                  模式
                </View>
                <View className='product-form-block-item-right t-a-r'>
                  {(!formData.sale_style && formData.sale_style !== 0 && formData.sale_style !== '0') &&
                    <View className='mepty'>
                      未添加
                      <View className='ret-image'>
                        <AtIcon value='icon icon-a-2tubiaozhizuomoban-01-011' size='14' />
                      </View>
                    </View>}
                  {
                    (formData.sale_style || formData.sale_style === 0 || formData.sale_style === '0') &&
                    <View className='value'>
                      <View className='m-r-10'>
                        {this.getSaleStyle(formData.sale_style).label}
                      </View>
                      <View className='ret-image'>
                        <AtIcon value='icon icon-a-2tubiaozhizuomoban-01-011' size='14' />
                      </View>
                    </View>
                  }
                </View>
              </View>
            </Picker>
          }
          <Picker
            mode='selector'
            range={goodsSiteList}
            rangeKey='label'
            onChange={({detail: {value}}) => this.siteChange('supplier_id', goodsSiteList[value].value)}
            value={formData.supplier_id}
          >
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require'>
                所属商家
              </View>
              <View className='product-form-block-item-right t-a-r'>
                {!formData.supplier_id && <View className='mepty'>
                  未添加
                  <Text className='ret'>{`>`}</Text>
                </View>}
                {formData.supplier_id && <View className='value c-666'>
                  {this.getSupplierName(formData.supplier_id)}
                </View>}
              </View>
            </View>
          </Picker>
          {!isMailGoods && formData.supplier_id && identity !== '1' &&
            <View className={`product-form-block-item border-bottom ${showGoods ? 'o-n' : ''}`}>
              <View className='product-form-block-item-left require'>
                所属门店
              </View>
              <View className='product-form-block-item-right o-n'>
                <CheckGrounp
                  onChange={(e) => this.storeChange('supplier_checker_group_id', e)}
                  data={storeList}
                  value={formData.supplier_checker_group_id}
                  isAll
                />
                <View
                  className='ret-image1'
                  onClick={() => this.useState('showGoods', !showGoods)}
                  style={showGoods ? 'transform: rotate(-180deg); bottom: 2px;' : ''}
                >
                  <AtIcon
                    value='icon icon-a-2tubiaozhizuomoban-01-011'
                    size='14'
                  />
                </View>
              </View>
            </View>}
          {!isMailGoods && <View className='product-form-block-item border-bottom'>
            <View style='width: 100%;display: flex;'>
              {
                process.env.TARO_ENV == 'weapp' &&
                <View style='padding: 0; width: 100%;' onClick={() => this.showAreas(true, formData.randKeys)}>
                  <View className='addcheck'
                    style='position:relative;display: flex; align-items: center; height: 100%;'
                  >
                    <View className='product-form-block-item-left require c-fff'>
                      所属地区
                    </View>
                    <View className='product-form-block-item-right t-a-l'
                      style='display: flex; align-items: center; justify-content: space-between;'
                    >
                      {formData.add
                        ?
                        <Text style='line-height: 35px;'
                          className='f-s-26'
                        >{formData.add && formData.add.replace(/,/g, "")}</Text>
                        :
                        <Text style='color:#666;line-height: 35px;' className='f-s-26'>选择省市区</Text>
                      }
                      <View className='retImage'><AtIcon value='chevron-right' size='14' color='#888888' /></View>
                    </View>
                  </View>
                </View>
              }
              {
                process.env.TARO_ENV == 'h5' &&
                <View className='product-form-block-item border-bottom addClassCity'>
                  <View style='width: 100%;display: flex;'>
                    <Picker
                      mode='multiSelector' // 多列选择
                      onColumnChange={this.onColumnChanges} // 某列改变的事件
                      range={pcaDatas} //需要展示的数据
                      value={cityValue} // 选择的下标
                      onChange={this.addChanges.bind(this)}
                      rangeKey='name'
                      style='width: 100%;'
                    >
                      <View style='padding: 0; width: 100%;'>
                        <View className='addcheck'
                          style='position:relative;display: flex; align-items: center; height: 100%;'
                        >
                          <View className='product-form-block-item-left require c-fff'>
                            所属地区
                          </View>
                          <View className='product-form-block-item-right t-a-l'>
                            {formData.add
                              ?
                              <Text className='f-s-26'>{formData.add && formData.add.replace(/,/g, "")}</Text>
                              :
                              <Text style='color:#B6B7B8;' className='f-s-26'>选择省市区</Text>
                            }
                            <View className='ret-image'><AtIcon value='chevron-right' size='14' color='#B6B7B8' /></View>
                          </View>
                        </View>
                      </View>
                    </Picker>
                  </View>
                </View>
              }
            </View>
          </View>}
          {!isMailGoods && <View className='product-form-block-item border-bottom'>
            <View className='product-form-block-item-left require'>
              所属地址
            </View>
            <View className='product-form-block-item-right t-a-l'>
              <View className='value'>
                <Input
                  placeholder='请输入所属地址'
                  onInput={({detail: {value}}) => {
                    formData['address'] = value;
                    this.setState({formData})
                  }}
                  value={formData.address}
                />
              </View>
            </View>
          </View>}
          {isHotel && <Picker
            mode='selector'
            range={selectData.brand}
            rangeKey='label_name'
            onChange={({detail: {value}}) => this.setBrandStart(value, 'brand')}
            value={formData.brand}
          >
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require'>
                品牌
              </View>
              <View className='product-form-block-item-right t-a-r'>
                {!formData.brand && <View className='mepty'>
                  未添加
                  <Text className='ret'>{`>`}</Text>
                </View>}
                {formData.brand && <View className='value c-666'>
                  {this.getBrandStart(formData.brand, 'brand')}
                  <Text className='ret'>{`>`}</Text>
                </View>}
              </View>
            </View>
          </Picker>}
          {isHotel && <Picker
            mode='selector'
            range={selectData.star}
            rangeKey='label_name'
            onChange={({detail: {value}}) => this.setBrandStart(value, 'star')}
            value={formData.star}
          >
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require'>
                星级
              </View>
              <View className='product-form-block-item-right t-a-r'>
                {!formData.star && <View className='mepty'>
                  未添加
                  <Text className='ret'>{`>`}</Text>
                </View>}
                {formData.star && <View className='value c-666'>
                  {this.getBrandStart(formData.star, 'star')}
                  <Text className='ret'>{`>`}</Text>
                </View>}
              </View>
            </View>
          </Picker>}
          <Navigator
            url={`/main/productForm/edit?key=goods_lightspot&value=` + encodeURIComponent(formData.goods_lightspot)}
          >
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require'>
                产品卖点
              </View>
              <View className='product-form-block-item-right t-a-r'>
                <View className='mepty'>
                  {formData.goods_lightspot ? '已添加' : '未添加'}
                  <Text className='ret'>{`>`}</Text>
                </View>
              </View>
            </View>
          </Navigator>
          <View className='product-form-block-item-left require'
            style='position: relative;top: 5px; margin: 7px 0;'
          >产品图片</View>
          {
            process.env.TARO_ENV === 'weapp' &&
            <View className='product-form-block-gounp border-bottom'>
              <AtImagePicker
                files={fileList}
                onChange={this.onFileChange.bind(this)}
                multiple
              />
            </View>
          }
          {
            process.env.TARO_ENV === 'h5' &&
            <View className='product-form-block-gounp border-bottom'>
              {
                fileList && fileList.map((item, imageIndex) =>
                  <View className='_image-border' key={imageIndex}>
                    <View className='_close' onClick={(e) => {
                      const list = JSON.parse(JSON.stringify(fileList));
                      list.splice(imageIndex, 1);
                      this.onFileChange(list, {}, imageIndex);
                      e.stopPropagation();
                    }}
                    >
                      <Text className='_font'>
                        x
                      </Text>
                    </View>
                    <Image src={item.url} className='_image'></Image>
                  </View>
                )
              }
              <View className='image-border' onClick={() => this.onFileChange()}>
                <View className='add'>+</View>
              </View>
            </View>
          }
        </View>
        <View className='product-form-block m-t-0'>
          {!isMailGoods &&
            <Navigator url={`/main/productForm/edit?key=mealDetails&value=` + encodeURIComponent(formData.mealDetails)}>
              <View className='product-form-block-item border-bottom'>
                <View className='product-form-block-item-left require c-fff'>
                  套餐详情
                </View>
                <View className='product-form-block-item-right t-a-r'>
                  <View className='mepty'>
                    {formData.mealDetails ? '已添加' : '未添加'}
                    <Text className='ret'>{`>`}</Text>
                  </View>
                </View>
              </View>
            </Navigator>
          }
          <Navigator
            url={`/main/productForm/edit?key=attention_matter&value=` + encodeURIComponent(formData.attention_matter || formData.use_notice)}
          >
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require c-fff'>
                购买须知
              </View>
              <View className='product-form-block-item-right t-a-r'>
                <View className='mepty'>
                  {formData.attention_matter || formData.use_notice ? '已添加' : '未添加'}
                  <Text className='ret'>{`>`}</Text>
                </View>
              </View>
            </View>
          </Navigator>
          {/* <Navigator url={`/main/productForm/edit?key=use_notice&value=${formData.use_notice}`}>
            <View className="product-form-block-item border-bottom">
              <View className="product-form-block-item-left require c-fff">
                购买须知
              </View>
              <View className="product-form-block-item-right t-a-r">
                <View className="mepty">
                  { formData.use_notice? '已添加': '未添加' }
                  <Text className="ret">{`>`}</Text>
                </View>
              </View>
            </View>
          </Navigator> */}
          <Navigator url={`/main/productForm/edit?key=detail_intro&value=` + encodeURIComponent(formData.detail_intro)}>
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left require c-fff'>
                详细介绍
              </View>
              <View className='product-form-block-item-right t-a-r'>
                <View className='mepty'>
                  {formData.detail_intro ? '已添加' : '未添加'}
                  <Text className='ret'>{`>`}</Text>
                </View>
              </View>
            </View>
          </Navigator>
        </View>
        {isFlashSale && <View className='product-form-block m-t-20'>
          <View>
            {
              specification && specification.map((item, index) => {
                return (
                  current == index && <View className='border-bottom' key={index}>
                    <Navigator
                      url={`/main/productForm/edit?key=notice&index=${index}&isNotice=1&value=` + encodeURIComponent(item.notice || '')}
                    >
                      <View className='product-form-block-item'>
                        <View className='product-form-block-item-left require c-fff'>
                          购买须知
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <View className='mepty'>
                            {item.notice ? '已添加' : '未添加'}
                            <Text className='ret'>{`>`}</Text>
                          </View>
                        </View>
                      </View>
                    </Navigator>
                  </View>
                )
              })
            }
          </View>
          {
            specification && specification.map((item, index) => {
              return (
                <View key={index}>
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        开售日期
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker mode='date' onChange={({detail: {value}}) => this.setSpecification('sell_begin', value)}
                          value={item.sell_begin}
                        >
                          <View className='value' style={`color:${item.sell_begin ? '#000' : '#c5c5c5'};`}>
                            {item.sell_begin || '请选择日期'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        开售时间
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker
                          mode='multiSelector' // 多列选择
                          onChange={this.onChangeTime1} // change事件
                          range={rangeTimeData} //需要展示的数据
                          value={item.rangeTimeVal1} // 选择的下标
                        >
                          <View className='value' style={`color:${item._sell_time_begin ? '#000' : '#c5c5c5'};`}>
                            {item._sell_time_begin || '请选择时间'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        结束日期
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker mode='date' onChange={({detail: {value}}) => this.setSpecification('sell_end', value)}
                          value={item.sell_end}
                        >
                          <View className='value' style={`color:${item.sell_end ? '#000' : '#c5c5c5'};`}>
                            {item.sell_end || '请选择日期'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        结束时间
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker
                          mode='multiSelector' // 多列选择
                          onChange={this.onChangeTime} // change事件
                          range={rangeTimeData} //需要展示的数据
                          value={item.rangeTimeVal} // 选择的下标
                        >
                          <View className='value' style={`color:${item._sell_time_end ? '#000' : '#c5c5c5'};`}>
                            {item._sell_time_end || '请选择时间'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                </View>
              )
            })
          }
        </View>}
        {/*单品*/}
        {!isFlashSale && <View className='product-form-block m-t-20'>
          <View>
            <View className='product-form-block-item h-at'>
              <View className='w-100'>
                <AtTabs current={current} tabList={specification} onClick={this.handleTabClick.bind(this)} scroll>
                </AtTabs>
              </View>
              <View className='w-30 p-a f-right'>
                <View className='d-flex p-a wrap-icon'>
                  <View className='wrap-icon-ic'>
                    <NewIcon
                      className='icon iconfont icon-fuzhi-01'
                      font='24'
                      color='#0bbe7f'
                      top='4'
                      onClick={this.copyTab.bind(this)}
                    />
                  </View>
                  <View className='wrap-icon-ic'>
                    <NewIcon
                      className='icon iconfont icon-jiahao-01'
                      font='24'
                      color='#0bbe7f'
                      top='4'
                      onClick={this.addTab.bind(this)}
                    />
                  </View>
                  {current != 0 && <View className='wrap-icon-ic'>
                    <NewIcon
                      className='icon iconfont icon-jianhao-01'
                      font='24'
                      color='#0bbe7f'
                      top='4'
                      onClick={this.delTab.bind(this)}
                    />
                  </View>}
                </View>
              </View>
            </View>
            {
              specification && specification.map((item, index) => {
                return (
                  current == index && <View className='border-bottom' key={index}>
                    <View className='product-form-block-item'>
                      <View className='product-form-block-item-left require'>
                        商品名称
                      </View>
                      <View className='product-form-block-item-right t-a-l'>
                        <View className='value'>
                          <Input
                            placeholder='请输入商品名称'
                            onInput={({detail: {value}}) => {
                              const {formData} = this.state;
                              item.item_name = value;
                              this.setFormData(formData);
                            }}
                            value={item.item_name}
                          />
                        </View>
                      </View>
                    </View>
                    <Navigator
                      url={`/main/productForm/edit?key=notice&index=${index}&isNotice=1&value=` + encodeURIComponent(item.notice || '')}
                    >
                      <View className='product-form-block-item'>
                        <View className='product-form-block-item-left require c-fff'>
                          购买须知
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <View className='mepty'>
                            {item.notice ? '已添加' : '未添加'}
                            <Text className='ret'>{`>`}</Text>
                          </View>
                        </View>
                      </View>
                    </Navigator>
                  </View>
                )
              })
            }
          </View>
          {
            specification && specification.map((item, index) => {
              return (
                <View key={index}>
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        开售日期
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker mode='date' onChange={({detail: {value}}) => this.setSpecification('sell_begin', value)}
                          value={item.sell_begin}
                        >
                          <View className='value' style={`color:${item.sell_begin ? '#000' : '#c5c5c5'};`}>
                            {item.sell_begin || '请选择日期'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        开售时间
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker
                          mode='multiSelector' // 多列选择
                          onChange={this.onChangeTime1} // change事件
                          range={rangeTimeData} //需要展示的数据
                          value={item.rangeTimeVal1} // 选择的下标
                        >
                          <View className='value' style={`color:${item._sell_time_begin ? '#000' : '#c5c5c5'};`}>
                            {item._sell_time_begin || '请选择时间'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        结束日期
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker mode='date' onChange={({detail: {value}}) => this.setSpecification('sell_end', value)}
                          value={item.sell_end}
                        >
                          <View className='value' style={`color:${item.sell_end ? '#000' : '#c5c5c5'};`}>
                            {item.sell_end || '请选择日期'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                  {
                    current == index &&
                    <View className='product-form-block-item border-bottom'>
                      <View className='product-form-block-item-left require'>
                        结束时间
                      </View>
                      <View className='product-form-block-item-right t-a-r'>
                        <Picker
                          mode='multiSelector' // 多列选择
                          onChange={this.onChangeTime} // change事件
                          range={rangeTimeData} //需要展示的数据
                          value={item.rangeTimeVal} // 选择的下标
                        >
                          <View className='value' style={`color:${item._sell_time_end ? '#000' : '#c5c5c5'};`}>
                            {item._sell_time_end || '请选择时间'}
                          </View>
                        </Picker>
                      </View>
                    </View>
                  }
                </View>
              )
            })
          }
        </View>}
        {(formData.sale_style == 1 || isMailGoods || isFlashSale) && <View className='product-form-block m-t-20'>
          <View className='product-form-block-item border-bottom'>
            <View className='product-form-block-item-left require'>
              窗口价
            </View>
            <View className='product-form-block-item-right t-a-l'>
              <View className='value'>
                <Input
                  placeholder='设置商品划线价'
                  type='digit'
                  onInput={({detail: {value}}) => this.setSpecification('price', value)}
                  value={specification[current].price}
                />
              </View>
            </View>
          </View>
          <View className='product-form-block-item border-bottom'>
            <View className='product-form-block-item-left require'>
              销售价
            </View>
            <View className='product-form-block-item-right t-a-l'>
              <View className='value'>
                <Input
                  placeholder='给商品定个好价格'
                  type='digit'
                  onInput={({detail: {value}}) => this.setSpecification('seller_price', value)}
                  value={specification[current].seller_price}
                />
              </View>
            </View>
          </View>
          <View className='product-form-block-item border-bottom'>
            <View className='product-form-block-item-left require'>
              成本价格
            </View>
            <View className='product-form-block-item-right t-a-l'>
              <View className='value'>
                <Input
                  placeholder='设置商家采购价'
                  type='digit'
                  onInput={({detail: {value}}) => this.setSpecification('supplier_price', value)}
                  value={specification[current].supplier_price}
                />
              </View>
            </View>
          </View>
          <View className='product-form-block-item border-bottom'>
            <View className='product-form-block-item-left require'>
              限购库存
            </View>
            <View className='product-form-block-item-right t-a-l'>
              <View className='value'>
                <Input
                  placeholder='设置合理库存避免超卖'
                  type='number'
                  onInput={({detail: {value}}) => this.setSpecification('stock', value)}
                  value={specification[current].stock}
                />
              </View>
            </View>
          </View>
          {
            formData.tadpole_goods_index === 11 &&
            <View className='product-form-block-item border-bottom'>
              <View className='product-form-block-item-left'>
                虚拟库存
              </View>
              <View className='product-form-block-item-right t-a-l'>
                <View className='value'>
                  <Input
                    placeholder='设置虚拟库存'
                    type='number'
                    onInput={({detail: {value}}) => this.setSpecification('virtual_store', value)}
                    value={specification[current].virtual_store}
                  />
                </View>
              </View>
            </View>
          }
        </View>}
        {
          specification && specification.map((item, index) => {
            return (
              <View key={index}>
                {index == current &&
                  <View>
                    {/*日历价格*/}
                    {
                      !isFlashSale && !isMailGoods && formData.sale_style == 0 && current == index && item.calendar.map((items, cindex) => {
                        return (
                          <View className='product-form-block m-t-20 p-r' key={cindex}>
                            <View className='product-form-block-add'>
                              <NewIcon
                                className='icon iconfont icon-jiahao-01'
                                font='24'
                                color='#0bbe7f'
                                onClick={() => this.addCalendar(index)}
                              />
                              {
                                cindex != 0 && <NewIcon
                                  className='icon iconfont icon-jianhao-01'
                                  font='24'
                                  color='#0bbe7f'
                                  onClick={() => this.delCalendar(index)}
                                />
                              }
                            </View>
                            <View>
                              <View className='product-form-block-item border-bottom h-at'>
                                <View className='product-form-block-item-title'>日历价格</View>
                              </View>
                              <View className='product-form-block-item border-bottom h-at'>
                                <View className='product-form-block-item-left require'>
                                  时间范围
                                </View>
                                <View className='product-form-block-item-right t-a-l d-flex'>
                                  <Picker
                                    mode='date'
                                    onChange={
                                      ({detail: {value}}) => this.setCalendar('date_scope_start', value, cindex)
                                    }
                                    value={items.date_scope_start}
                                  >
                                    <View className='product-form-block-item-right t-a-c w-240 p-r-0'
                                      style={`color:${items.date_scope_start ? '#000' : '#c5c5c5'};`}
                                    >
                                      {items.date_scope_start || '选择使用时间'}
                                    </View>
                                  </Picker>
                                  <View className='product-form-block-item-right'>至</View>
                                  <Picker
                                    mode='date'
                                    onChange={
                                      ({detail: {value}}) => this.setCalendar('date_scope_end', value, cindex)
                                    }
                                    value={items.date_scope_end}
                                  >
                                    <View className='product-form-block-item-right t-a-c w-240 p-r-0'
                                      style={`color:${items.date_scope_end ? '#000' : '#c5c5c5'};`}
                                    >
                                      {items.date_scope_end || '选择使用时间'}
                                    </View>
                                  </Picker>
                                </View>
                              </View>
                              <View className='product-form-block-item h-at'>
                                <View className='product-form-block-item-left w-at f-169 require c-fff'>
                                  时间选择
                                </View>
                                <View className='product-form-block-item-right nowrap'>
                                  <View className='_check'>
                                    <Check
                                      value='全部'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: 'all', cindex})}
                                      isCheck={
                                        items.date_choice.indexOf(1) != -1 &&
                                        items.date_choice.indexOf(2) != -1 &&
                                        items.date_choice.indexOf(3) != -1 &&
                                        items.date_choice.indexOf(4) != -1 &&
                                        items.date_choice.indexOf(5) != -1 &&
                                        items.date_choice.indexOf(6) != -1 &&
                                        items.date_choice.indexOf(7) != -1
                                      }
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周一'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '1', cindex})}
                                      isCheck={items.date_choice.indexOf(1) != -1}
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周二'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '2', cindex})}
                                      isCheck={items.date_choice.indexOf(2) != -1}
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周三'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '3', cindex})}
                                      isCheck={items.date_choice.indexOf(3) != -1}
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周四'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '4', cindex})}
                                      isCheck={items.date_choice.indexOf(4) != -1}
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周五'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '5', cindex})}
                                      isCheck={items.date_choice.indexOf(5) != -1}
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周六'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '6', cindex})}
                                      isCheck={items.date_choice.indexOf(6) != -1}
                                    />
                                  </View>
                                  <View className='_check'>
                                    <Check value='周天'
                                      onChange={(isCheck) => this.dateChange({isCheck, value: '7', cindex})}
                                      isCheck={items.date_choice.indexOf(7) != -1}
                                    />
                                  </View>
                                </View>
                              </View>
                              <View className='product-form-block-item border-bottom h-at'>
                                <View className='product-form-block-item-left require'>
                                  窗口价
                                </View>
                                <View className='product-form-block-item-right t-a-l'>
                                  <Input
                                    placeholder='设置商品划线价'
                                    type='digit'
                                    onInput={({detail: {value}}) => this.setCalendar('price', value, cindex)}
                                    value={items.price}
                                  />
                                </View>
                              </View>
                              <View className='product-form-block-item border-bottom h-at'>
                                <View className='product-form-block-item-left require'>
                                  销售价
                                </View>
                                <View className='product-form-block-item-right t-a-l'>
                                  <Input
                                    placeholder='给商品定个好价格'
                                    type='digit'
                                    onInput={({detail: {value}}) => this.setCalendar('seller_price', value, cindex)}
                                    value={items.seller_price}
                                  />
                                </View>
                              </View>
                              <View className='product-form-block-item border-bottom h-at'>
                                <View className='product-form-block-item-left require'>
                                  成本价格
                                </View>
                                <View className='product-form-block-item-right t-a-l'>
                                  <Input
                                    placeholder='设置商家采购价'
                                    type='digit'
                                    onInput={({detail: {value}}) => this.setCalendar('supplier_price', value, cindex)}
                                    value={items.supplier_price}
                                  />
                                </View>
                              </View>
                              <View className='product-form-block-item border-bottom h-at'>
                                <View className='product-form-block-item-left require'>
                                  限购库存
                                </View>
                                <View className='product-form-block-item-right t-a-l'>
                                  <Input
                                    type='number'
                                    placeholder='设置合理库存避免超卖'
                                    onInput={({detail: {value}}) => this.setCalendar('stock', value, cindex)}
                                    value={items.stock}
                                  />
                                </View>
                              </View>
                            </View>
                          </View>
                        )
                      })
                    }

                    {/*儿童限制*/}
                    {!isMailGoods && !isHotel && <View className='product-form-block m-t-20'>
                      <View className='product-form-block-item border-bottom'>
                        <View className='product-form-block-item-left require c-fff'>
                          儿童限制
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <NewSwitch
                            color={process.env.mainColor}
                            onChange={(value) => this.useRuleChange('is_child', value)}
                            isCheck={formData.specification[current].use_rule.is_child == 1}
                          />
                        </View>
                      </View>
                      {
                        (formData.specification[current].use_rule.is_child == 1) && <View>
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require c-fff'>
                              身高
                            </View>
                            <View className='product-form-block-item-right t-a-l'>
                              <Input
                                placeholder='请输入儿童身高'
                                onInput={({detail: {value}}) => this.useRuleChange('child_stature', value)}
                                value={specification[current].use_rule.child_stature}
                              />
                            </View>
                          </View>
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require c-fff'>
                              年龄
                            </View>
                            <View className='product-form-block-item-right t-a-l'>
                              <Input
                                placeholder='请输入儿童年龄'
                                type='number'
                                onInput={({detail: {value}}) => this.useRuleChange('child_age', value)}
                                value={specification[current].use_rule.child_age}
                              />
                            </View>
                          </View>
                        </View>
                      }
                    </View>}
                    {/*额外*/}
                    {!isMailGoods && <View className='product-form-block m-t-20'>
                      <View className='product-form-block-item border-bottom'>
                        <View className='product-form-block-item-left require c-fff'>
                          额外费用
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <NewSwitch
                            color={process.env.mainColor}
                            onChange={(value) => this.setIsShow('additionalCosts', value)}
                            isCheck={isShow[current].additionalCosts}
                          />
                        </View>
                      </View>
                      {isShow[current].additionalCosts && <View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            费用价格
                          </View>
                          <View
                            className='product-form-block-item-right t-a-r'
                            style={`${process.env.TARO_ENV == 'weapp' ? 'position: relative; top: 10px;' : ''}`}
                          >
                            <View className='d-flex justify-content-fe h-100'>
                              <Input
                                type='digit'
                                onInput={({detail: {value}}) => this.useRuleChange('concreteness_cost', value)}
                                value={specification[current].use_rule.concreteness_cost}
                                style='transform: translateX(0) translateY(-50%);'
                                placeholder='请输入费用价格'
                              />
                            </View>
                          </View>
                        </View>
                      </View>
                      }
                    </View>}

                    {/*邮寄设置*/}
                    {isMailGoods && <View className='product-form-block m-t-20'>
                      <View className='product-form-block-item border-bottom'>
                        <View className='product-form-block-item-left require c-fff'>
                          邮寄设置
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <NewSwitch
                            color={process.env.mainColor}
                            onChange={(value) => this.isPostShow('is_post', value)}
                            isCheck={specification[current].is_post}
                          />
                        </View>
                      </View>
                      {specification[current].is_post && <View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            运费价格
                          </View>
                          <View
                            className='product-form-block-item-right t-a-r'
                            style={`${process.env.TARO_ENV == 'weapp' ? 'position: relative; top: 10px;' : ''}`}
                          >
                            <View className='d-flex justify-content-fe h-100'>
                              <Input
                                type='digit'
                                onInput={({detail: {value}}) => this.isPostChange('freight', value)}
                                value={specification[current].freight}
                                style='transform: translateX(0) translateY(-50%);'
                                placeholder='请输入运费价格'
                              />
                            </View>
                          </View>
                        </View>
                      </View>
                      }
                    </View>}
                    <View className='product-form-block m-t-20'>
                      {/* <View className="product-form-block-item border-bottom">
                        <View className="product-form-block-item-left require c-fff">
                          使用时间
                        </View>
                        <Picker
                          mode='date'
                          onChange={
                            ({detail: {value}}) => this.changeUseRuleStart(value)
                          }
                          value = {item.effective_begin}
                        >
                          <View className="product-form-block-item-right t-a-c w-240 p-r-0" style={`color:${item.effective_begin? '#000': '#c5c5c5'};`}>
                            {item.effective_begin || '选择使用时间'}
                          </View>
                        </Picker>
                        <View className="product-form-block-item-right">至</View>
                        <Picker
                          mode='date'
                          onChange={
                            ({detail: {value}}) => this.changeUseRuleEnd(value)
                          }
                          value = {item.effective_end}
                        >
                          <View className="product-form-block-item-right t-a-c w-240 p-r-0" style={`color:${item.effective_end? '#000': '#c5c5c5'};`}>
                            {item.effective_end || '选择使用时间'}
                          </View>
                        </Picker>
                      </View> */}
                    </View>
                    {/** 酒店没有可用日期 */}
                    {!isMailGoods && <View>
                      <View className='product-form-block m-t-20'>
                        <Picker
                          mode='selector'
                          range={usageTimeList}
                          onChange={({detail: {value}}) => this.setSpecification('valid_type', value)}
                          rangeKey='label'
                          value={item.valid_type_index}
                        >
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require'>
                              可用日期
                            </View>
                            <View className='product-form-block-item-right t-a-r'>
                              {!item.valid_type_name && <View className='mepty m-r-10'>
                                未添加
                                <View className='ret-image'>
                                  <AtIcon value='icon icon-a-2tubiaozhizuomoban-01-011' size='14' />
                                </View>
                              </View>}
                              <View className='value m-r-10'>
                                <Text className='m-r-10'>
                                  {item.valid_type_name}
                                </Text>
                                <View className='ret-image'>
                                  <AtIcon value='icon icon-a-2tubiaozhizuomoban-01-011' size='14' />
                                </View>
                              </View>
                            </View>
                          </View>
                        </Picker>
                        {((formData.sale_style == 0 && (item.valid_type == 1 || item.valid_type == 2) || (formData.sale_style == 1 && item.valid_type == 2))) &&
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require'>
                              几天内
                            </View>
                            <View className='product-form-block-item-right t-a-l'>
                              <Input
                                type='digit'
                                maxLength={6}
                                onInput={({detail: {value}}) => this.setSpecification('valid_date_days', value)}
                                value={item.valid_date_days}
                                placeholder='请输入天数'
                              />
                            </View>
                          </View>
                        }
                        {((formData.sale_style == 0 && item.valid_type == 5) || (formData.sale_style == 1 && item.valid_type == 5)) &&
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require'>
                              截止日期
                            </View>
                            <View className='product-form-block-item-right t-a-r'>
                              <Picker mode='date'
                                onChange={({detail: {value}}) => this.setSpecification('valid_date_limit_end', value)}
                                value={item.valid_date_limit_end}
                              >
                                <View className='value'
                                  style={`color:${item.valid_date_limit_end ? '#000' : '#c5c5c5'};`}
                                >
                                  {item.valid_date_limit_end || '请选择日期'}
                                </View>
                              </Picker>
                            </View>
                          </View>}
                        {((formData.sale_style == 0 && item.valid_type == 6) || (formData.sale_style == 1 && item.valid_type == 6)) &&
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require'>
                              指定时段
                            </View>
                            <Picker
                              mode='date'
                              onChange={
                                ({detail: {value}}) => this.changeUseRuleStart(value)
                              }
                              value={item.effective_begin}
                            >
                              <View className='product-form-block-item-right t-a-c w-240 p-r-0'
                                style={`color:${item.effective_begin ? '#000' : '#c5c5c5'};`}
                              >
                                {item.effective_begin || '选择使用时间'}
                              </View>
                            </Picker>
                            <View className='product-form-block-item-right'>至</View>
                            <Picker
                              mode='date'
                              onChange={
                                ({detail: {value}}) => this.changeUseRuleEnd(value)
                              }
                              value={item.effective_end}
                            >
                              <View className='product-form-block-item-right t-a-c w-240 p-r-0'
                                style={`color:${item.effective_end ? '#000' : '#c5c5c5'};`}
                              >
                                {item.effective_end || '选择使用时间'}
                              </View>
                            </Picker>
                          </View>}
                      </View>
                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            核验时间
                          </View>
                          <Picker
                            mode='time'
                            onChange={
                              ({detail: {value}}) => this.setSpecification('valid_date_time_begin', value)
                            }
                            value={item.valid_date_time_begin}
                          >
                            <View className='product-form-block-item-right t-a-c w-240 p-r-0'
                              style={`color:${item.valid_date_time_begin ? '#000' : '#c5c5c5'};`}
                            >
                              {item.valid_date_time_begin || '选择使用时间'}
                            </View>
                          </Picker>
                          <View className='product-form-block-item-right'>至</View>
                          <Picker
                            mode='time'
                            onChange={
                              ({detail: {value}}) => this.setSpecification('valid_date_time_end', value)
                            }
                            value={item.valid_date_time_end}
                          >
                            <View className='product-form-block-item-right t-a-c w-240 p-r-0'
                              style={`color:${item.valid_date_time_end ? '#000' : '#c5c5c5'};`}
                            >
                              {item.valid_date_time_end || '选择使用时间'}
                            </View>
                          </Picker>
                        </View>
                      </View>
                      <View className='product-form-block m-t-20'>
                        <Picker
                          mode='selector'
                          range={takeEffectList}
                          onChange={({detail: {value}}: any) => this.setSpecification('reserve_date_style', value)}
                          rangeKey='label'
                          value={item.reserve_date_style}
                        >
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require c-fff'>
                              购买设置
                            </View>
                            <View className='product-form-block-item-right t-a-r'>
                              {
                                !item.reserve_date_style_name &&
                                <View className='mepty'>
                                  未添加
                                  <Text className='ret'>{`>`}</Text>
                                </View>
                              }
                              {item.reserve_date_style_name &&
                                <View className='value'>
                                  {item.reserve_date_style_name}
                                  <Text className='ret'>{`>`}</Text>
                                </View>
                              }
                            </View>
                          </View>
                        </Picker>
                        {specification[current].reserve_date_style == 1 &&
                          <View className='product-form-block-flex-sa border-bottom'>
                            <View className='product-form-block-item-left require c-fff'>
                              下单后
                            </View>
                            <View className='product-form-block-flex-sa'>
                              <View className='w-33'
                                style={`${process.env.TARO_ENV == 'weapp' ? 'position: relative; top: 10px;' : ''}`}
                              >
                                <Input
                                  type='digit'
                                  maxLength={6}
                                  onInput={({detail: {value}}) => this.setSpecification('verification_limit', value)}
                                  value={specification[current].verification_limit}
                                  style='width: 20px;'
                                />
                              </View>
                              <View className='w-33'>小时后生效</View>
                            </View>
                          </View>}
                        {(item.reserve_date_style == 2) &&
                          <View className='product-form-block-flex-sa border-bottom' style='width: 100%;'>
                            <View className='product-form-block-it平台管理em-left require c-fff'>
                              需提前
                            </View>
                            <View className='product-form-block-flex-sa'>
                              <View
                                style={`${process.env.TARO_ENV == 'weapp' ? 'position: relative; top: 10px; width: 20px;' : 'position: relative; width: 20px;'}`}
                              >
                                <Input
                                  type='digit'
                                  maxLength={6}
                                  onInput={({detail: {value}}) => this.setSpecification('booking_day_end', value)}
                                  value={specification[current].booking_day_end}
                                />
                              </View>
                              <View className='w-33'>天</View>
                              <Picker
                                mode='time'
                                onChange={({detail: {value}}) => this.setSpecification('booking_time_end', value)}
                                value={specification[current].booking_time_end}
                              >
                                <View className='picker'
                                  style={`color:${specification[current].booking_time_end ? '#000' : '#c5c5c5'};`}
                                >
                                  {specification[current].booking_time_end || '请选择时间'}
                                </View>
                              </Picker>
                              <View className='w-33'>之前预约</View>
                            </View>
                          </View>}
                        <Picker
                          mode='selector'
                          range={TicketList}
                          onChange={({detail: {value}}) => this.setSpecification('get_ticket_way', parseInt(value.toString()) + 1)}
                          rangeKey='label'
                          value={formData.specification[current].get_ticket_way - 1}
                        >
                          <View className='product-form-block-item border-bottom'>
                            <View className='product-form-block-item-left require c-fff'>
                              取票方式
                            </View>
                            <View className='product-form-block-item-right t-a-r'>
                              {!formData.specification[current].get_ticket_way && <View className='mepty'>
                                未添加
                                <Text className='ret'>{`>`}</Text>
                              </View>}
                              {formData.specification[current].get_ticket_way && <View className='value'>
                                {this.getTicketWay(formData.specification[current].get_ticket_way - 1)}
                              </View>}
                            </View>
                          </View>
                        </Picker>
                      </View>
                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            下单限制
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            <NewSwitch
                              color={process.env.mainColor}
                              onChange={(value) => this.setSpecification('order_limit', value)}
                              isCheck={item.order_limit}
                            />
                          </View>
                        </View>
                      </View>
                    </View>}

                    {!isMailGoods && item.order_limit == 1 && <View>
                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            账号限制
                          </View>
                        </View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            几天内
                          </View>
                          <View className='product-form-block-item-right .t-a-l'>
                            <Input
                              type='digit'
                              maxLength={6}
                              onInput={({detail: {value}}) => this.useOrderLimitChange('account', 'day', value)}
                              value={specification[current].order_limit_config.account.day}
                              placeholder='请输入天数'
                            />
                          </View>
                        </View>
                        <View className='product-form-block-flex-sa border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            最多购买
                          </View>
                          <View className='product-form-block-flex-sa'>
                            <View className='w-33'>
                              <View className='d-flex justify-content-fe'>
                                <Input
                                  type='number'
                                  maxLength={6}
                                  className='top-10 t-a-r'
                                  onInput={({detail: {value}}) =>
                                    this.useOrderLimitChange('account', 'count', value)
                                  }
                                  value={specification[current].order_limit_config.account.count}
                                />
                                <View>单</View>
                              </View>
                            </View>
                            <View className='w-33'>
                              <View className='d-flex justify-content-fe'>
                                <Input
                                  type='number'
                                  maxLength={6}
                                  className='top-10 t-a-r'
                                  onInput={({detail: {value}}) =>
                                    this.useOrderLimitChange('account', 'orderCount', value)
                                  }
                                  value={specification[current].order_limit_config.account.orderCount}
                                />
                                <View>份</View>
                              </View>
                            </View>
                          </View>
                        </View>
                      </View>

                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            手机号限制
                          </View>
                        </View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            几天内
                          </View>
                          <View className='product-form-block-item-right .t-a-l'>
                            <Input
                              type='digit'
                              maxLength={6}
                              onInput={({detail: {value}}) => this.useOrderLimitChange('phone', 'day', value)}
                              value={specification[current].order_limit_config.phone.day}
                              placeholder='请输入天数'
                            />
                          </View>
                        </View>
                        <View className='product-form-block-flex-sa border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            最多购买
                          </View>
                          <View className='product-form-block-flex-sa'>
                            <View className='w-33'>
                              <View className='d-flex justify-content-fe'>
                                <Input
                                  type='digit'
                                  maxLength={6}
                                  className='top-10 t-a-r'
                                  onInput={({detail: {value}}) =>
                                    this.useOrderLimitChange('phone', 'count', value)
                                  }
                                  value={specification[current].order_limit_config.phone.count}
                                />
                                <View>单</View>
                              </View>
                            </View>
                            <View className='w-33'>
                              <View className='d-flex justify-content-fe'>
                                <Input
                                  type='digit'
                                  maxLength={6}
                                  className='top-10 t-a-r'
                                  onInput={({detail: {value}}) =>
                                    this.useOrderLimitChange('phone', 'orderCount', value)
                                  }
                                  value={specification[current].order_limit_config.phone.orderCount}
                                />
                                <View>份</View>
                              </View>
                            </View>
                          </View>
                        </View>
                      </View>

                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            身份证限制
                          </View>
                        </View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            几天内
                          </View>
                          <View className='product-form-block-item-right .t-a-l'>
                            <Input
                              type='digit'
                              maxLength={6}
                              onInput={({detail: {value}}) => this.useOrderLimitChange('idcard', 'day', value)}
                              value={specification[current].order_limit_config.idcard.day}
                              placeholder='请输入天数'
                            />
                          </View>
                        </View>
                        <View className='product-form-block-flex-sa border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            最多购买
                          </View>
                          <View className='product-form-block-flex-sa'>
                            <View className='w-33'>
                              <View className='d-flex justify-content-fe'>
                                <Input
                                  type='digit'
                                  maxLength={6}
                                  className='top-10 t-a-r'
                                  onInput={({detail: {value}}) =>
                                    this.useOrderLimitChange('idcard', 'count', value)
                                  }
                                  value={specification[current].order_limit_config.idcard.count}
                                />
                                <View>单</View>
                              </View>
                            </View>
                            <View className='w-33'>
                              <View className='d-flex justify-content-fe'>
                                <Input
                                  type='digit'
                                  maxLength={6}
                                  className='top-10 t-a-r'
                                  onInput={({detail: {value}}) =>
                                    this.useOrderLimitChange('idcard', 'orderCount', value)
                                  }
                                  value={specification[current].order_limit_config.idcard.orderCount}
                                />
                                <View>份</View>
                              </View>
                            </View>
                          </View>
                        </View>
                      </View>

                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff w-175'>
                            每笔订单限制
                          </View>
                        </View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            最少购买
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            <View className='d-flex justify-content-fe'>
                              <Input
                                type='digit'
                                maxLength={6}
                                onInput={({detail: {value}}) =>
                                  this.useOrderLimitChange('order', 'min', value)
                                }
                                value={specification[current].order_limit_config.order.min}
                              />
                              <View>份</View>
                            </View>
                          </View>
                        </View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            最多购买
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            <View className='d-flex justify-content-fe'>
                              <Input
                                type='digit'
                                maxLength={6}
                                onInput={({detail: {value}}) =>
                                  this.useOrderLimitChange('order', 'max', value)
                                }
                                value={specification[current].order_limit_config.order.max}
                              />
                              <View>份</View>
                            </View>
                          </View>
                        </View>
                      </View>
                      {/* 2021 10.18  酒店民宿不显示 区域限制和年龄*/}
                      {!isHotel && <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom w-100 d-none'>
                          <View className='product-form-block-item-left require c-fff w-100 d-none'>
                            区域限制(区域不填代表不限制)
                          </View>
                        </View>
                        <View style='height: 42px; position: relative;' className='border-bottom'>
                          <View style='position: absolute; top: 50%; transform: translateY(-50%);'>
                            <RadioGrounp
                              onChange={({value}) => this.setSpecification('order_limit_idcard_region', value)}
                              data={areaRadioList}
                              wNo
                              isCheck={item.order_limit_idcard_region}
                              size='13px'
                            />
                          </View>
                        </View>
                        {
                          specification[current].order_limit_config.idcard_region.map((itemc, indexs) =>
                            <View className='product-form-block-item border-bottom' key={indexs}>
                              <View style='width: 100%;display: flex;'>
                                {
                                  process.env.TARO_ENV == 'weapp' &&
                                  <View style='padding: 0; width: 100%;'
                                    onClick={() => this.showArea(true, indexs, itemc.randKey)}
                                  >
                                    <View className='addcheck h-100'
                                      style='position:relative;display: flex; justify-content: space-between; align-items: center;'
                                    >
                                      {itemc.add
                                        ?
                                        <Text style='line-height: 35px;'
                                          className='f-s-26'
                                        >{itemc.add && itemc.add.replace(/,/g, "")}</Text>
                                        :
                                        <Text style='color:#666;line-height: 35px;' className='f-s-26'>选择省市区</Text>
                                      }
                                      <View className='retImage'>
                                        <AtIcon value='chevron-right' size='14' color='#888888' />
                                      </View>
                                    </View>
                                  </View>
                                }
                                {
                                  process.env.TARO_ENV == 'h5' &&
                                  <View className='product-form-block-item border-bottom addClassCity' key={indexs}>
                                    <View style='width: 100%;display: flex;'>
                                      <Picker
                                        mode='multiSelector' // 多列选择
                                        onColumnChange={this.onColumnChange} // 某列改变的事件
                                        range={pcaData} //需要展示的数据
                                        value={cityValue} // 选择的下标
                                        onChange={this.addChange.bind(this, indexs)}
                                        rangeKey='name'
                                        style='width: 100%;'
                                      >
                                        <View style='padding: 0; width: 100%;'>
                                          <View className='addcheck'
                                            style='position:relative;display: flex; justify-content: space-between; align-items: center; height: 100%;'
                                          >
                                            {itemc.add
                                              ?
                                              <Text style='line-height: 35px;'
                                                className='f-s-26'
                                              >{itemc.add && itemc.add.replace(/,/g, "")}</Text>
                                              :
                                              <Text style='color:#666;line-height: 35px;'
                                                className='f-s-26'
                                              >选择省市区</Text>
                                            }
                                            <View className='ret-image'>
                                              <AtIcon value='chevron-right' size='14' color='#888888' />
                                            </View>
                                          </View>
                                        </View>
                                      </Picker>
                                    </View>
                                  </View>
                                }
                                {
                                  indexs == 0 && <NewIcon
                                    className='icon iconfont icon-jiahao-01'
                                    font='24'
                                    color='#0bbe7f'
                                    onClick={(e) => {
                                      this.addIdcardRegion();
                                      e.stopPropagation();
                                    }}
                                  />
                                }
                                <NewIcon
                                  className='icon iconfont icon-jianhao-01'
                                  font='24'
                                  color='#0bbe7f'
                                  onClick={(e) => {
                                    this.delIdcardRegion(indexs);
                                    e.stopPropagation();
                                  }}
                                />
                              </View>
                            </View>
                          )
                        }
                      </View>}
                      {!isHotel && <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            年龄限制
                          </View>
                        </View>
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            周岁
                          </View>
                          <View className='product-form-block-flex-sa t-a-l'>
                            <View className='w-33'>
                              <Input
                                type='digit'
                                maxLength={6}
                                onInput={({detail: {value}}) =>
                                  this.useOrderLimitChange('age', 'min', value)
                                }
                                value={specification[current].order_limit_config.age.min}
                                style='position: relative; top: 10px; text-align: center;'
                              />
                            </View>
                            <View style='width: 30px;' className='t-a-c'>至</View>
                            <View className='w-33'>
                              <Input
                                type='digit'
                                maxLength={6}
                                onInput={({detail: {value}}) =>
                                  this.useOrderLimitChange('age', 'max', value)
                                }
                                value={specification[current].order_limit_config.age.max}
                                style='position: relative; top: 10px; text-align: center;'
                              />
                            </View>
                          </View>
                        </View>
                      </View>}
                    </View>}
                    <View className='product-form-block m-t-20'>
                      <View className='allow-refund-picker'>
                        <View className='left-range'>
                          <Picker
                            mode='selector'
                            range={refundList}
                            onChange={({detail: {value}}) => this.setSpecification('is_allow_refund', value)}
                            rangeKey='label'
                            value={formData.specification[current].is_allow_refund}
                          >
                            <View className='product-form-block-item border-bottom'>
                              <View className='product-form-block-item-left require c-fff'>
                                退票规则
                              </View>
                              <View className='product-form-block-item-right t-a-r'>
                                {!specification[current].is_allow_refund_name && <View className='mepty'>
                                  未添加
                                  <View className='ret-image'>
                                    <AtIcon value='icon icon-a-2tubiaozhizuomoban-01-011' size='14' />
                                  </View>
                                </View>}
                                {specification[current].is_allow_refund_name && <View className='value m-r-10'>
                                  <Text className='m-r-10'>
                                    {specification[current].is_allow_refund_name}
                                  </Text>
                                  <View className='ret-image'>
                                    <AtIcon value='icon icon-a-2tubiaozhizuomoban-01-011' size='14' />
                                  </View>
                                </View>}
                              </View>
                            </View>
                          </Picker>
                        </View>
                        {
                          formData.specification[current].is_allow_refund !== "" &&
                          <View className='clear-allow-refund' onClick={() => this.clearAllowRefund(index)}>
                            <AtIcon value='close-circle' size='16' color='#f30' />
                          </View>
                        }
                      </View>
                      {formData.specification[current].is_allow_refund == 2 &&
                        <View className='product-form-block-flex-sa w-100 border-bottom'>
                          <View className='product-form-block-item-auto require c-fff'>
                            需检票截止日期前
                          </View>
                          <View className='product-form-block-flex-sa'>
                            <View
                              style={`${process.env.TARO_ENV == 'weapp' ? 'position: relative; top: 10px; position: relative; width: 30px;' : 'position: relative; width: 30px;'}`}
                            >
                              <Input
                                type='digit'
                                maxLength={6}
                                onInput={({detail: {value}}) => this.useXDayRefundRule('day', value)}
                                value={specification[current].x_day_refund_rule.day}
                              />
                            </View>
                            <View>天,并在</View>
                            <Picker
                              mode='time'
                              onChange={({detail: {value}}) => this.useXDayRefundRule('time', value)}
                              value={specification[current].x_day_refund_rule.time}
                            >
                              <View className='picker'
                                style={`color:${specification[current].x_day_refund_rule.time ? '#000' : '#c5c5c5'};`}
                              >
                                {specification[current].x_day_refund_rule.time || '请选择时间'}
                              </View>
                            </Picker>
                            <View>前可退</View>
                          </View>
                        </View>}
                    </View>

                    {
                      process.env.P_ENV === 'kd' &&
                      <View className='product-form-block m-t-20'>
                        <View className='product-form-block-item h-at'>
                          <View className='product-form-block-item-left w-at f-169 require c-fff'>
                            退款标签
                          </View>
                          <View className='product-form-block-item-right nowrap'>
                            <View className='_checkSign'>
                              <Check
                                value='全部'
                                onChange={(isCheck) => this.refundSignChange({isCheck, value: 'all'})}
                                isCheck={
                                  formData.specification[current].refund_sign && formData.specification[current].refund_sign.indexOf(0) != -1 &&
                                  formData.specification[current].refund_sign.indexOf(1) != -1 &&
                                  formData.specification[current].refund_sign.indexOf(2) != -1
                                }
                              />
                            </View>
                            <View className='_checkSign'>
                              <Check value='过期退'
                                onChange={(isCheck) => this.refundSignChange({isCheck, value: '0'})}
                                isCheck={formData.specification[current].refund_sign && formData.specification[current].refund_sign.indexOf(0) != -1}
                              />
                            </View>
                            <View className='_checkSign'>
                              <Check value='全款退'
                                onChange={(isCheck) => this.refundSignChange({isCheck, value: '1'})}
                                isCheck={formData.specification[current].refund_sign && formData.specification[current].refund_sign.indexOf(1) != -1}
                              />
                            </View>
                            <View className='_checkSign'>
                              <Check value='未预约随时退'
                                onChange={(isCheck) => this.refundSignChange({isCheck, value: '2'})}
                                isCheck={formData.specification[current].refund_sign && formData.specification[current].refund_sign.indexOf(2) != -1}
                              />
                            </View>
                          </View>
                        </View>
                      </View>
                    }

                    <View className='product-form-block p-b-60 m-t-20'>
                      <View className='product-form-block-item'>
                        <View className='product-form-block-item-title w-100 t-a-l'>
                          客户信息填写
                        </View>
                      </View>
                      <View className='product-form-block-item'>
                        <RadioGrounp
                          onChange={({value}) => this.setSpecification('is_custom_item', value)}
                          data={checkData}
                          wNo
                          isCheck={formData.specification[current].is_custom_item}
                        />
                      </View>
                      <View className='product-form-block-item h-at'>
                        <View className='product-form-block-item-left t-a-l w-at require c-fff'>
                          必填信息
                        </View>
                        <View className='product-form-block-item-right nowrap _no'>
                          <View className='_check'>
                            <Check
                              value='身份证'
                              onChange={(isCheck) => this.setCustomItemConfig('idcard', isCheck)}
                              isCheck={specification[current].custom_item_config.idcard}
                            />
                          </View>
                          <View className='_check'>
                            <Check
                              value='邮寄地址'
                              onChange={(isCheck) => this.setCustomItemConfig('address', isCheck)}
                              isCheck={specification[current].custom_item_config.address}
                            />
                          </View>
                          <View className='_check'>
                            <Check
                              value='备注'
                              onChange={(isCheck) => this.setCustomItemConfig('comments', isCheck)}
                              isCheck={specification[current].custom_item_config.comments}
                            />
                          </View>
                          <View className='_check'>
                            <Check
                              value='图片'
                              onChange={(isCheck) => this.setCustomItemConfig('upload_file', isCheck)}
                              isCheck={specification[current].custom_item_config.upload_file}
                            />
                          </View>
                          <View className='_check'>
                            <Check
                              value='留言'
                              onChange={(isCheck) => this.setCustomItemConfig('mark', isCheck)}
                              isCheck={specification[current].custom_item_config.mark}
                            />
                          </View>
                          <View className='_check'>
                            <Check
                              value='采集人脸'
                              onChange={(isCheck) => this.setCustomItemConfig('face', isCheck)}
                              isCheck={specification[current].custom_item_config.face}
                            />
                          </View>
                          <View className='_check' onClick={this.addCompanyList.bind(this)}>
                            自定义项目
                          </View>
                        </View>
                      </View>
                      <View>
                        {
                          item.companyList && item.companyList.map((items, indexs) =>
                            <View
                              className='d-flex'
                              style={`${process.env.TARO_ENV === 'weapp' ? 'width: 100%;' : 'align-items: center;margin-bottom: 8px;'}`}
                              key={indexs}
                            >
                              <View
                                className='product-form-block-item-left t-a-l w-100 require c-fff'
                                style={`${process.env.TARO_ENV === 'weapp' ? 'd-flex: 0 0 64px;position: relative;top:16px;' : ''}`}
                              >
                                <Check
                                  onChange={
                                    (isCheck) => {
                                      this.pushCompanyList('ckd', isCheck, indexs);
                                    }
                                  }
                                  isCheck={items.ckd}
                                  value='必填'
                                />
                              </View>
                              <View
                                className='product-form-block-item-right nowrap'
                                style={`${process.env.TARO_ENV === 'weapp' ? 'position: relative; top: 0px;' : 'height: 35px;'}`}
                              >
                                <Input
                                  className='_input m-r-10'
                                  placeholder='请输入自定义项'
                                  onInput={
                                    ({detail: {value}}) => {
                                      this.pushCompanyList('k', value, indexs);
                                    }
                                  }
                                  value={items.k}
                                />
                                <Text
                                  style={`${process.env.TARO_ENV === 'h5' ? 'position: absolute; right: 0; top: 50%; transform: translateY(-50%);' : ''}`}
                                >
                                  {indexs == 0 && <NewIcon
                                    className='icon iconfont icon-jiahao-01'
                                    font='24'
                                    color='#0bbe7f'
                                    top={process.env.TARO_ENV === 'h5' ? '0' : '-2'}
                                    onClick={this.addCompanyList.bind(this, 'companyList')}
                                  />}
                                  {indexs > 0 && <NewIcon
                                    className='icon iconfont icon-jianhao-01'
                                    font='24'
                                    color='#0bbe7f'
                                    top='-2'
                                    onClick={this.delCompanyList.bind(this, indexs)}
                                  />}
                                </Text>
                              </View>
                            </View>
                          )
                        }
                      </View>
                    </View>
                    <View className='product-form-block m-t-20'>
                      <Picker
                        mode='selector'
                        range={settlementList}
                        onChange={({detail: {value}}) => this.setSpecification('settlement_way', value)}
                        rangeKey='label'
                        value={item.settlement_way}
                      >
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require'>
                            结算方式
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            {specification[current].settlement_way == undefined && specification[current].settlement_way != 0 &&
                              <View className='mepty'>
                                未添加
                                <Text className='ret'>{`>`}</Text>
                              </View>}
                            {specification[current].settlement_way != undefined && <View className='value'>
                              {this.getSettlement(item.settlement_way)}
                              <Text className='ret'>{`>`}</Text>
                            </View>}
                          </View>
                        </View>
                      </Picker>
                      {/** 酒店门票类去掉参与拼团和是否需预约 */}
                      {formData.sale_style == 1 &&
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            参与拼团
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            <NewSwitch
                              color={process.env.mainColor}
                              onChange={(value) => this.useRuleChange('is_collage', value)}
                              isCheck={formData.specification[current].use_rule.is_collage}
                            />
                          </View>
                        </View>
                      }
                      {!isMailGoods && formData.sale_style == 1 &&
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require c-fff'>
                            是否需预约
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            <NewSwitch
                              color={process.env.mainColor}
                              onChange={(value) => this.useRuleChange('is_appointment', value)}
                              isCheck={formData.specification[current].use_rule.is_appointment}
                            />
                          </View>
                        </View>
                      }
                      {!isMailGoods && <View className='product-form-block-item border-bottom'>
                        <View className='product-form-block-item-left require c-fff'>
                          节假日可用
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <NewSwitch
                            color={process.env.mainColor}
                            onChange={(value) => this.useRuleChange('is_holidays', value)}
                            isCheck={formData.specification[current].use_rule.is_holidays}
                          />
                        </View>
                      </View>}
                      <Picker
                        mode='selector'
                        range={windowList}
                        onChange={({detail: {value}}) => this.setSpecification('tadpole_use_system', value)}
                        rangeKey='label'
                        value={item.tadpole_use_system_index}
                      >
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require'>
                            使用系统
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            <View className='business-form-block-item-right'>
                              {item.tadpole_use_system && this.getWindow(item.tadpole_use_system_index).label || '无'}
                              <Text className='ret'>{`>`}</Text>
                            </View>
                          </View>
                        </View>
                      </Picker>
                      <View className='product-form-block-item border-bottom'>
                        <View className='product-form-block-item-left require'>
                          开票金额
                        </View>
                        <View className='product-form-block-item-right t-a-r'>
                          <RadioGrounp
                            onChange={({value}) => this.setSpecification('ticket_money', value)}
                            data={moneyData}
                            wNo
                            isCheck={item.ticket_money}
                            size='13px'
                          />
                        </View>
                      </View>
                      <Picker
                        mode='selector'
                        range={doBusiness}
                        onChange={({detail: {value}}) => this.setSpecification('tadpole_open_type', value)}
                        rangeKey='label'
                        value={item.tadpole_open_type_index}
                      >
                        <View className='product-form-block-item border-bottom'>
                          <View className='product-form-block-item-left require'>
                            商家类型
                          </View>
                          <View className='product-form-block-item-right t-a-r'>
                            {item.tadpole_open_type == undefined && <View className='mepty'>
                              未添加
                              <Text className='ret'>{`>`}</Text>
                            </View>}
                            {item.tadpole_open_type != undefined && <View className='value'>
                              {this.getDoBusiness(item.tadpole_open_type_index).label}
                              <Text className='ret'>{`>`}</Text>
                            </View>}
                          </View>
                        </View>
                      </Picker>
                    </View>
                    <View className='h-130' />
                    <View className='foot-btn'>
                      <View className={`${process.env.TARO_ENV === 'h5' ? "btn h5-small" : "btn"}`}
                        onClick={() => this.save()}
                      >
                        {
                          submiting && submitType == 0 && <AtIcon value='loading-2' size='16' />
                        }
                        <Text style={{"padding-left": "5px"}}>保存</Text>
                      </View>
                      <View className={`${process.env.TARO_ENV === 'h5' ? "btn h5-small active" : "btn active"}`}
                        onClick={() => this.save(1)}
                      >
                        {
                          submiting && submitType == 1 && <AtIcon value='loading-2' size='16' />
                        }
                        <Text style={{"padding-left": "5px"}}>保存并提交</Text>
                      </View>
                    </View>
                  </View>
                }
              </View>
            );
          })
        }
        {areaHide &&
          <View
            style='position: fixed; left: 0; top: 0; background: rgba(0, 0, 0, .5); width: 100%; height: 100%; z-index: 999;'
          >
            <View style='position: absolute; bottom: 0; width: 100%; left: 0; background-color: #fff;'>
              <View className='dispersed'>
                <View className='left' onClick={() => this.showArea(false)}>取消</View>
                <View className='right' onClick={() => this.addChange()}>保存</View>
              </View>
              <PickerView
                indicatorStyle='height: 50px; line-height: 50px;'
                style='width: 100%; height: 300px;'
                onChange={this.onSlide}
                value={randKey}
              >
                <PickerViewColumn style='width: 33.3%'>
                  {this.state.addressData && this.state.addressData.map((item, index) => {
                    return (
                      <View style='text-align: center; line-height: 50px;' key={index}>{item.name}</View>
                    );
                  })}
                </PickerViewColumn>
                <PickerViewColumn style='width: 33.3%'>
                  {
                    this.state.addressData[province] && this.state.addressData[province].areaList && this.state.addressData[province].areaList.map((item, index) => {
                      return (
                        <View style='text-align: center; line-height: 50px;' key={index}>{item.name}</View>
                      );
                    })
                  }
                </PickerViewColumn>
                <PickerViewColumn style='width: 33.3% text-align: center;'>
                  {
                    this.state.addressData[province] && this.state.addressData[province].areaList[city].areaList && this.state.addressData[province].areaList[city].areaList.map((item, index) => {
                      return (
                        <View style='text-align: center; line-height: 50px;' key={index}>{item.name}</View>
                      );
                    })
                  }
                </PickerViewColumn>
              </PickerView>
            </View>
          </View>
        }
        {areaHideTwo &&
          <View
            style='position: fixed; left: 0; top: 0; background: rgba(0, 0, 0, .5); width: 100%; height: 100%; z-index: 999;'
          >
            <View style='position: absolute; bottom: 0; width: 100%; left: 0; background-color: #fff;'>
              <View className='dispersed'>
                <View className='left' onClick={() => this.showAreas(false)}>取消</View>
                <View className='right' onClick={() => this.addChanges()}>保存</View>
              </View>
              <PickerView
                indicatorStyle='height: 50px; line-height: 50px;'
                style='width: 100%; height: 300px;'
                onChange={this.onSlide}
                value={formData.randKeys}
              >
                <PickerViewColumn style='width: 33.3%'>
                  {this.state.addressData && this.state.addressData.map((item, index) => {
                    return (
                      <View style='text-align: center; line-height: 50px;' key={index}>{item.name}</View>
                    );
                  })}
                </PickerViewColumn>
                <PickerViewColumn style='width: 33.3%'>
                  {
                    this.state.addressData[province] && this.state.addressData[province].areaList && this.state.addressData[province].areaList.map((item, index) => {
                      return (
                        <View style='text-align: center; line-height: 50px;' key={index}>{item.name}</View>
                      );
                    })
                  }
                </PickerViewColumn>
                <PickerViewColumn style='width: 33.3% text-align: center;'>
                  {
                    this.state.addressData[province] && this.state.addressData[province].areaList[city].areaList && this.state.addressData[province].areaList[city].areaList.map((item, index) => {
                      return (
                        <View style='text-align: center; line-height: 50px;' key={index}>{item.name}</View>
                      );
                    })
                  }
                </PickerViewColumn>
              </PickerView>
            </View>
          </View>
        }
      </View>
    );
  }
}

export default productForm as ComponentClass;
